QBasic and QB64 Discussion Board

[QB Forum Archives (1999-2009)/ ] [QB FAQ] [QB Links and Downloads] [Subforums and Chat Room] [Search]

QB64.Net Homepage   QB/QB64 Keywords   QB Graphics Forum   Homework Policy



Loading sprites with default palette?

by Brian (no login)

Is there anyway to load bitmap images without changing the default color palette in screen 13? I'm pretty sure there's got to be a way, instead of changing the palette, just "round" the colors to the nearest fit on the default palette.

Posted on May 31, 2013, 8:42 PM

Respond to this message   

Return to Index


One possibility...

by (Login qb432l)
R

In a Photo/Paint program, you can convert your bitmap to 8-bit, system palette. There are a couple of options, System 666 and System 676. That way, when you load the bitmap the SCREEN 13 palette isn't affected.

Of course, it depends on your Photo/Paint app -- Windows Paint has no such option, but many do.

-Bob

Posted on May 31, 2013, 11:21 PM

Respond to this message   

Return to Index


* Paint.net and GIMP

by (Login The-Universe)
Admin

Posted on Jun 1, 2013, 12:04 AM

Respond to this message   

Return to Index


Re: One possibility...

by Brian (no login)

"Yeah I tried saving photo in windows paint as "256 color bitmap" but that still didn't work. Ill try GIMP later on today and see

Posted on Jun 1, 2013, 6:46 AM

Respond to this message   

Return to Index


Not JUST as a 256 color bitmap, but as a SYSTEM 256 color bitmap...

by (Login qb432l)
R

When you save it as a SYSTEM 256 color bitmap, your Photo/Paint app renders all the colors in the closest default palette colors rather than changing the palette. In other words, exactly what you wanted.

And NOT Windows Paint - there couldn't be a worse app for converting bit depth - EVER!!

-Bob

Posted on Jun 1, 2013, 8:51 AM

Respond to this message   

Return to Index


I've seen worse. The old Paint had no options...:-)

by (Login burger2227)
R

This could all be solved simply by using QB64 with those 24 bit bitmaps in a 32 bit _NEWIMAGE screen mode. You could even make the white background color clear.

Posted on Jun 1, 2013, 11:23 AM

Respond to this message   

Return to Index


Windows Paint (mspaint) has its uses...

by (Login qb432l)
R

For example, for pasting images, you can slide them anywhere with great precision. Also, adding text is great -- you basically have a text editor with font and color control, and can see what you're getting as you work.

However, for bit-depth conversion, even Windows Paint warns you that you may not like the results. Try converting a 24-bit image to 8-bit. You're lucky if you even get a recognizable image.

-Bob

P.S. I now have 7 lessons in the new QB64 version of QBG.

Posted on Jun 1, 2013, 2:30 PM

Respond to this message   

Return to Index


Hmmm, what is taking you so long?

by (Login burger2227)
R

I converted my Qbasics Demo and most chapters worked right out of the box. Of course it doesn't use the mouse except in Chapter 15 which won't work well because it uses other mouse and file functions with Interrupt.

Posted on Jun 1, 2013, 2:59 PM

Respond to this message   

Return to Index


converted it to ?

by (Login GarryRicketson)
R

Did you convert it to run with qb64 ?,If so, is it the same download that is in your signature,? (at PetesQbsite)but updated, I would like to try it,or if you don't mind post a link here, thanks
EDITED:
Actually I answered my own question, just downloaded it and see that it has been converted. However to work with qb64 for Linux, I will need to make some changes, don't know if I know how, but will try,..
maybe I can get some help,..it is cause the
QB-DEM0.bat , Linux dose not use batch files, however a .sh file could be made to do the same thing as the batch file,..then all that would be needed is change the code, that calls for qb-demo.bat, so that it it executes the .sh file,..basicly just a new filename,..
if anyone can and wants to help on this, I am going to start a topic in the Linux forum,
It sure would be nice to have this tutorial available to Linux users as well as windows users.

Posted on Jun 1, 2013, 3:33 PM

Respond to this message   

Return to Index


It's the same QBG graphics tutorial, Garry...

by (Login qb432l)
R

I'm re-compiling it in QB64 so it will run in Windows. As it is, you either need an old computer, or DOSBox in order to run it. Makes sense, since all of the graphics commands work in QB64, too.

-Bob

Posted on Jun 1, 2013, 4:04 PM

Respond to this message   

Return to Index


Sounds great,..

by (Login GarryRicketson)
R

That sounds good though, yes I know, at this time, that is how I run it, with dos box, but it runs even better on my older computer, with Dos,(FreeDos) and qb4.5
Once you have it for QB64 for windows, I will do the same, start trying to compile it with qb64 for linux,...maybe if I am lucky I wont have to change anything ,...
On Clippy's, qbasics, I ran into a problem,because it uses a batch file, but I don't think it will be to hard to fix,..

Posted on Jun 1, 2013, 4:19 PM

Respond to this message   

Return to Index


The source won't be included in the zip...

by (Login qb432l)
R

...but if you'd like to compile it for Linux, I'll send you QBG.BAS separately (when it's finished). All the other files should work. I'd be interested to see if it will run under Linux.

Yes, under DOSBox, there are a few glitches and speed issues - no question that it runs better on your older machine.

-Bob

Posted on Jun 1, 2013, 6:40 PM

Respond to this message   

Return to Index


* CHAIN does not work in Linus yet

by (Login burger2227)
R

Posted on Jun 1, 2013, 7:20 PM

Respond to this message   

Return to Index


*No problem, the CHAIN's are all gone thanks to QB64's mega-capacity.

by (Login qb432l)
R

*

Posted on Jun 1, 2013, 8:17 PM

Respond to this message   

Return to Index


Sounds good,

by (Login GarryRicketson)
R

Ok, that sounds good, I would like to try it,
thanks

Posted on Jun 1, 2013, 7:32 PM

Respond to this message   

Return to Index


Re: The source won't be included in the zip...

by (Login GarryRicketson)
R

"..but if you'd like to compile it for Linux, I'll send you QBG.BAS separately"
That would be great, I don't know if my e-mail adress is avialable to the public
, here it is, but please copy it, and let me know you have it, so I can remove it , I don't want to leave it on the board for a long time, thanks,


From Garry
http://creativeminds.webege.com/SMF/index.php

Posted on Jun 4, 2013, 5:16 AM

Respond to this message   

Return to Index


Bob here is a list of the QB64 keywords that won't work in Linus or Mac.

by (Login burger2227)
R

http://qb64.net/wiki/index.php?title=Keywords_currently_not_supported_by_QB64#Keywords_Not_Supported_in_Linux_or_MAC_OSX_versions

Why not include the source code? It would allow everybody to compile it on their native OS. QB64 makes the EXE so large that the source would not add that much to the download. The DLL files add a lot to it too.

Maybe you could make a download of just the files necessary to compile it without the DLL files too.

Posted on Jun 4, 2013, 6:30 AM

Respond to this message   

Return to Index


*Thanks, Ted. QBG doesn't use any of those :-)

by (Login qb432l)
R

*

Posted on Jun 4, 2013, 10:00 AM

Respond to this message   

Return to Index


Garry: regarding your email...

by (Login qb432l)
R

Just email ME, Garry (click TheBOB), with some nothing message. Then I'll have your email on my computer. QBG.BAS is a text file. I'll change the name to QBG.TXT and you can rename it .BAS before you compile it. That way there shouldn't be any problem. It's about 500Mb, so let me know if that's too big. D'oh (slaps forehead). Of course, I could always just drop it in my new DropBox box and you could grab a copy there.

-Bob

Posted on Jun 4, 2013, 9:58 AM

Respond to this message   

Return to Index


*ok thanks

by (Login GarryRicketson)
R

Posted on Jun 4, 2013, 10:42 AM

Respond to this message   

Return to Index


500mb is fine,

by (Login GarryRicketson)
R

No, thats not to big,...thanks

Posted on Jun 4, 2013, 4:29 PM

Respond to this message   

Return to Index


Bat files not needed

by (Login GarryRicketson)
R

Ok, I saw what you said at PetesQBsite, and that is right, the bat file is not needed, if I compile the chapters they compile and run, with qb64 for linux.

Posted on Jun 1, 2013, 5:53 PM

Respond to this message   

Return to Index


Mostly the mouse is holding things up, Clippy...

by (Login qb432l)
R

For example, the color lesson includes a mouse-controlled color-mixing console. Lots of fun getting that running smoothly using unfamiliar mouse routines. Works fine now, but it took some work. Also, since QB64 is so fast, I've had to add _DELAY's at a lot of places so that one mouse click didn't take you through an entire lesson - lol! Stuff like that. Plus, of course, I also eat and sleep sometimes.

-Bob

Posted on Jun 1, 2013, 4:09 PM

Respond to this message   

Return to Index


Don't forget _LIMIT

by (Login burger2227)
R

_DELAY stops the program in its tracks. _MOUSEINPUT can be put in a program loop to read the clicks every loop. Then you can't miss a click or release. If you use a WHILE _MOUSEINPUT loop to read the mouse it may miss clicks or releases as it will loop until it catches up.

DO 'program loop

i = _MOUSEINPUT
b = _MOUSEBUTTON(1)
IF b THEN
DO WHILE b
i = _MOUSEINPUT
b = _MOUSEBUTTON(1)
'you could also check coordinates to confirm the user release of the mouse on the button area.
LOOP
END IF

LOOP

Posted on Jun 1, 2013, 5:53 PM

Respond to this message   

Return to Index


*Good to know. I was using a loop, so I guess that's why it didn't check for releases.

by (Login qb432l)
R

*

Posted on Jun 1, 2013, 6:43 PM

Respond to this message   

Return to Index


Note that Paint.net is not Windows..

by Pete (Login The-Universe)
Admin

I like Paint.net better than GIMP, personally. I wish a German product called PhotoMagic was still supported. It died on MS platforms when they went to Win XP for some reason, and the developer never bothered to update the software. It didn't have layers, but the precision and ease of use was so phenomenal, you didn't need layers.

Pete

Posted on Jun 1, 2013, 9:00 AM

Respond to this message   

Return to Index


Delays?

by Brian (no login)

I have a question about delays in QBASIC, my teacher thought us just to do something like this:

for x = 1 to 640 step 10
for t = 1 to 3000000 * .1 ' empty timer to delay the program by about 1 second (way less on a good CPU)
circle(oldx,50),5,0
circle(x,50),5,1
oldx = x
next x

but, this type of delay doesn't work properly because it varies by the computer's processing speed. Is there any better way of doing this? I've seen something like this:

delay = TIMER

if TIMER - delay <= 3 then
blah blah blah
end if

is that for something completely different or just a more reliable delay?

Posted on May 31, 2013, 4:55 PM

Respond to this message   

Return to Index


Blah, blah, blah

by (Login burger2227)
R

Print "Read fast as you only have 5 seconds...."

Delay 5
CLS
PRINT "Read faster because...!"
Delay .2
SYSTEM


SUB Delay (dlay!)
start! = TIMER
DO WHILE start! + dlay! >= TIMER
IF start! > TIMER THEN start! = start! - 86400 'midnight adjustment
LOOP
END SUB

Download my QBasics Demo. It has all kinds of tricks:

http://bit.ly/MXFkTM

Posted on May 31, 2013, 5:45 PM

Respond to this message   

Return to Index


Your program crashes.

by Ed Asner (Login The-Universe)
Admin

It doesn't even start right away, and then when it does, I see something pop up, which after three tries, I is the word "Read" but I'm not sure, because just about when I get there, the screen disappears! Please fix this. It is annoying. You know it is important to me when I have to take two hours out of my busy day to type this reply.

- Ed

Posted on Jun 1, 2013, 9:09 AM

Respond to this message   

Return to Index


Try this with qb64

by (Login GarryRicketson)
R

PRINT "Read fast as you only have 5 seconds...."

_DELAY 5
CLS
PRINT "Read faster because...!"
_DELAY .2
SYSTEM
----------------
I tried it with the SUB, and it worked ok, but I did have to change the second Delay, to 1 instead of .2,..a slower reader would need it to be slower, like 10 or 20
-------edited-----
This works better, with sleep, you can take a nap if you want and still be able to read it,
when you press any key, it is not that the program crashes, it is the End, finished, no more program,...
----code below---
PRINT "Read fast as you only have 5 seconds...."

Delay 5
CLS
PRINT "Read faster because...!"
PRINT "Press any key when ready"
SLEEP
SYSTEM


SUB Delay (dlay!)
start! = TIMER
DO WHILE start! + dlay! >= TIMER
IF start! > TIMER THEN start! = start! - 86400 'midnight adjustment
LOOP
END SUB
----- end code -----

Posted on Jun 1, 2013, 10:18 AM

Respond to this message   

Return to Index


Game help (gem swap)

by (no login)

I am having a little trouble figuring out the logic i need for various aspects of my gem swapping game.
for example a good formula for checking if more than 3 tiles are already the same color before the table is displayed the first time....um having them fall down a level when 3 are aligned...stuff like that. i dont expect anyone to write this for me, but i am very new to prgramming and and help would be much obliged. heres what i got so far. Mostly just playing around trying to figure out the logic i need to use. so far all i got is the primitive graphics going on:

scrn& = _NEWIMAGE(800, 500, 32)
SCREEN scrn&

RANDOMIZE TIMER


TYPE gem
alive AS INTEGER
x AS INTEGER
y AS INTEGER
kind AS INTEGER
END TYPE

DIM tiles(25)
DIM gems(25) AS gem

FOR i = 1 TO 25
gems(i).kind = INT(RND * 4) + 1
gems(i).alive = 1
tiles(i) = gems(i).kind
NEXT i


FOR i = 1 TO 5
gems(i).x = i * 40
gems(i).y = 1 * 40
gems(i + 5).x = i * 40
gems(i + 5).y = 2 * 40
gems(i + 10).x = i * 40
gems(i + 10).y = 3 * 40
gems(i + 15).x = i * 40
gems(i + 15).y = 4 * 40
gems(i + 20).x = i * 40
gems(i + 20).y = 5 * 40
NEXT i

DIM colum(25)
DIM row(25)

FOR i = 1 TO 25
colum(i) = gems(i).y
row(i) = gems(i).x
NEXT i
colors& = _RGB(0, 0, 0)

_DEST scrn&
_PRINTMODE _KEEPBACKGROUND

DO

FOR i = 1 TO 25
IF tiles(i) = 1 THEN colors& = _RGB(255, 0, 0)
IF tiles(i) = 2 THEN colors& = _RGB(0, 0, 255)
IF tiles(i) = 3 THEN colors& = _RGB(0, 255, 0)
IF tiles(i) = 4 THEN colors& = _RGB(255, 0, 255)

LINE (gems(i).x - 15, gems(i).y - 15)-(gems(i).x + 15, gems(i).y + 15), colors&, BF

NEXT i

_DISPLAY
LOOP UNTIL INKEY$ = CHR$(27)

Posted on May 30, 2013, 3:37 PM

Respond to this message   

Return to Index


Three tiles the same color

by (Login The-Universe)
Admin

REDIM cnt(4)

For i = 1 to 25
cnt(tile(i)) = cnt(tile(i)) + 1
next

for i = 1 to 4
if cnt(i) >= 3 then flag = -1: exit for: REM 3 or more, OK to display.
next

if flag = - 1 then
flag = 0
REM Allow display
end if


---------------------------

That's a counter.

Pete

Posted on May 30, 2013, 4:18 PM

Respond to this message   

Return to Index


im used to baby counters! lol

by david (no login)

That took me a min to decipher which is just sad. im used to
...count=count+1
type stuff . that is an excellent counter sir. im starting to think i should wait on this game im starting to think its a little kutta my league at the moment.

Posted on May 30, 2013, 4:52 PM

Respond to this message   

Return to Index


Just when I thought everything was perfect...

by Brian (no login)

Hey guys, it seems like this whole BLOADING / BSAVING thing is going to be harder than expected... I really appreciate all the help I've gotten from Clippy, Pete, and Bob. But now it seems like i have another problem lol. So, I guess the BSAVER I'm using changes the color palette to emulate 24-bit colors. This is a problem because when I send two images to the screen at once, the first one gets distorted and it also changes the colors of some of the pre-existing graphics. Here are some screenshots I took, hope you guys can help

This is what the "battlefield" should look like (without any images loaded)
http://gyazo.com/a31aab9a1942362e77ae79ca71d0c0a0

This is what happens to the "battlefield" when I send out the first sprite
http://gyazo.com/e895921c84859b004e600060b44f1ec4

And this is what happens when I send out the second sprite
http://gyazo.com/7fabd400dec3cd93200cb161836a7672

So... yeah... As a programming novice, I have no idea how to even go about fixing this.

Posted on May 30, 2013, 2:25 PM

Respond to this message   

Return to Index


BSAVER / BLOADER Programs

by Brian (no login)

Forgot to add the programs I'm using if that helps at all

BSAVER (this program loads a Bitmap and converts it to a .B13 file)

'BSAVER.BAS 2008 by Ted Weissgerber. Saves 1, 4, 8 or 24 BPP bitmaps to BSAVE File(s).
'NOTE: Screen 12 may require up to 3 BSV numbered files for fullscreen.
' Screen 13 will save almost fullscreen into one BSV file.
' BEST Bitmap colors are in 4 bit(Screen 12) or 8 bit(Screen 13)! 24 bit color is simulated.

DEFINT A-Z
DECLARE SUB GetInfo (TC$)
DECLARE SUB FourBIT ()
DECLARE SUB OneBIT ()
DECLARE SUB TrueColor ()
DECLARE SUB GetRGB (Array())
DECLARE SUB ScanBMP (Changed(), Image()) '?
DECLARE SUB EightBIT ()
DECLARE SUB BMPColors (Custom(), Normal())
DECLARE SUB BSaveOne ()
DECLARE SUB BSaver ()
DECLARE SUB AutoClr (Custom())
DECLARE SUB TrueGrey ()
DECLARE SUB Border (Colr)
DECLARE SUB Closing ()

TYPE BMPHeaderType 'BITMAP HEADER TYPE
ID AS STRING * 2 'File ID is "BM"
Size AS LONG 'Size of the data file
Res1 AS INTEGER 'Reserved 1 should be 0
Res2 AS INTEGER 'Reserved 2 should be 0
Offset AS LONG 'Position of start of pixel data
Hsize AS LONG 'Information header size
PWidth AS LONG 'Image width
PDepth AS LONG 'Image height
Planes AS INTEGER 'number of planes
BPP AS INTEGER 'Bits per pixel, 8 for Screen 13, 256 color image
Compress AS LONG 'Compression
ImageBytes AS LONG 'Width * Height ,ImageSIZE
Xres AS LONG 'Width in PELS per metre
Yres AS LONG 'depth in PELS per metre
NumColors AS LONG 'Number of COLORS
SigColors AS LONG 'Significant COLORs
END TYPE

DIM SHARED BMPHead AS BMPHeaderType
DIM SHARED Image(26000)
DIM SHARED Changed(0 TO 255)
DIM SHARED FileName$, SaveName$, Scr, NColors, Clr, FileErr, Num '?

'MAIN PROGRAM
ON ERROR GOTO Handler
GetInfo TC$ 'gets filename errors, bitmap info and determines screen mode

IF Scr = 12 THEN
NColors = 16
REDIM Normal(0 TO 47)
REDIM Custom(0 TO 47)
ELSEIF Scr = 13 THEN
NColors = 256
REDIM Normal(0 TO 767)
REDIM Custom(0 TO 767)
END IF
GetRGB Normal() 'Default QB color settings
SELECT CASE BMPHead.BPP
CASE 1: OneBIT '12 or 13
CASE 4: FourBIT '12 or 13
CASE 8: EightBIT '13 only
CASE 24: IF Scr = 13 AND TC$ = "C" THEN TrueColor ELSE TrueGrey '12 greyscale only
END SELECT
GetRGB Custom() 'custom color settings from BMP
AutoClr Custom() 'find a visible color
ScanBMP Changed(), Image() 'find colors actually used by image
BMPColors Custom(), Normal() 'set used and default colors to Image array

DO: LOOP UNTIL INKEY$ = ""
DO: key$ = UCASE$(INKEY$): LOOP UNTIL key$ <> ""
COLOR Clr
IF key$ <> "B" THEN
IF Scr = 13 THEN LOCATE 25, 15 ELSE LOCATE 30, 30
PRINT "Bitmap not Saved!"; : SLEEP: Closing: SYSTEM
END IF
IF Scr = 12 THEN
PUT (232, 463), Image(48), PSET
IF BMPHead.PWidth * BMPHead.PDepth <= 102400 THEN BSaveOne ELSE BSaver 'up to full screen in 12
ELSEIF Scr = 13 THEN
PUT (112, 190), Image(768), PSET
IF BMPHead.PWidth * BMPHead.PDepth <= 50400 THEN BSaveOne ELSE BSaver 'up to full screen in 13
END IF
IF Scr = 12 THEN
LOCATE 30, 15: PRINT "BSaved as"; Num; "File(s) ending with "; UCASE$(SaveName$);
FOR i = 1 TO 15: LOCATE 12 + i, 76: COLOR i: PRINT i; : NEXT
ELSEIF Scr = 13 THEN
LOCATE 24, 10: PRINT "BSaved as"; Num MOD 4; "File(s)";
LOCATE 25, 10: PRINT "Ending with "; UCASE$(SaveName$);
DO: SLEEP: LOOP UNTIL INKEY$ <> ""
CLS : LOCATE 2, 1
FOR i = 1 TO 255: COLOR i: PRINT STR$(i); : NEXT
END IF
SLEEP
Closing
SYSTEM 'END of Main Program

Handler: 'check if file entry error or other error
BEEP
FileErr = -1
RESUME NEXT

SUB AutoClr (Custom()) 'sets bottom menu color
FOR i = 3 TO (3 * NColors) - 1 STEP 3
clrtot = Custom(i) + Custom(i + 1) + Custom(i + 2)
IF clrtot > 100 AND clrtot <> Custom(0) + Custom(1) + Custom(2) THEN Clr = i \ 3: EXIT SUB
NEXT
END SUB

SUB BMPColors (Custom(), Normal()) 'Resets to bitmap color values plus defaults set
OUT &H3C8, 0
FOR i = 0 TO (3 * NColors) - 1 STEP 3
IF Changed(i \ 3) = 1 THEN
OUT &H3C9, Custom(i): Image(i) = Custom(i)
OUT &H3C9, Custom(i + 1): Image(i + 1) = Custom(i + 1)
OUT &H3C9, Custom(i + 2): Image(i + 2) = Custom(i + 2)
ELSE
OUT &H3C9, Normal(i): Image(i) = Normal(i)
OUT &H3C9, Normal(i + 1): Image(i + 1) = Normal(i + 1)
OUT &H3C9, Normal(i + 2): Image(i + 2) = Normal(i + 2)
END IF
NEXT
END SUB

SUB Border (Colr)
COLOR Colr
FOR row = 1 TO 30
LOCATE row, 1: PRINT CHR$(179);
LOCATE row, 80: PRINT CHR$(179);
NEXT row
LOCATE 1, 1: PRINT STRING$(80, 196);
LOCATE 30, 1: PRINT STRING$(80, 196);
LOCATE 1, 1: PRINT CHR$(218);
LOCATE 1, 80: PRINT CHR$(191);
LOCATE 30, 1: PRINT CHR$(192);
LOCATE 30, 80: PRINT CHR$(217);
END SUB

SUB BSaveOne 'Bsave Screen 12 or 13 into One file with B12 or B13 extension
IF Scr = 12 THEN
SaveName$ = FileName$ + ".B12"
ELSEIF Scr = 13 THEN SaveName$ = FileName$ + ".B13"
END IF
DEF SEG = VARSEG(Image(0))
GET (0, 0)-(BMPHead.PWidth - 1, BMPHead.PDepth - 1), Image(NColors * 3) 'for 16 or 256 colors
LINE (0, 0)-(BMPHead.PWidth, BMPHead.PDepth), Clr, B
FOR a& = 26000 TO 0 STEP -1
IF Image(a&) THEN ArraySize& = a&: EXIT FOR
NEXT
BSAVE SaveName$, VARPTR(Image(0)), (2 * ArraySize&) + 200 'file size
DEF SEG
Num = 1
END SUB

SUB BSaver 'Bsave multiple files in screen 12 or 13
IF LEN(FileName$) > 7 THEN SaveFile$ = MID$(FileName$, 1, 7) ELSE SaveFile$ = FileName$
IF Scr = 12 THEN
Num = 0: Limit = 320: Spot = 159
ELSEIF Scr = 13 THEN
Num = 4: Limit = 100: Spot = 99
END IF
DEF SEG = VARSEG(Image(0))
FOR y = 0 TO Limit STEP Spot + 1 'save into 3 files
IF y + Spot <= BMPHead.PDepth - 1 THEN
GET (0, y)-(BMPHead.PWidth - 1, y + Spot), Image(3 * NColors) 'Full GET
LINE (0, y)-(BMPHead.PWidth - 1, y + Spot), Clr, B
IF y + Spot = BMPHead.PDepth - 1 THEN nobsave = -1
ELSE
GET (0, y)-(BMPHead.PWidth - 1, BMPHead.PDepth - 1), Image(3 * NColors) 'Partial GET ends loop
LINE (0, y)-(BMPHead.PWidth - 1, BMPHead.PDepth - 1), Clr, B
nobsave = -1
END IF
FOR a& = 26000 TO 3 * NColors STEP -1
IF Image(a&) THEN ArraySize& = a&: EXIT FOR
NEXT
Num = Num + 1 'change file name by number 1, 2, 3 (12) or 5, 6 (13)
SaveName$ = SaveFile$ + LTRIM$(STR$(Num)) + ".BSV"
BSAVE SaveName$, VARPTR(Image(0)), (2 * ArraySize&) + 200
IF nobsave THEN EXIT FOR
NEXT y
DEF SEG
END SUB

SUB Closing
CLS : PALETTE
IF Scr = 12 THEN Border 9
COLOR 11
IF Scr = 12 OR Scr = 0 THEN LOCATE 15, 30 ELSE LOCATE 12, 10
PRINT "Ted Weissgerber 2010"
IF Scr = 12 OR Scr = 0 THEN LOCATE 17, 30 ELSE LOCATE 14, 10
PRINT "burger2227@gmail.com"
SLEEP 3
END SUB

SUB EightBIT '************** 8 Bit Screen 13 Only 'Bob's Winbit

IF BMPHead.PWidth MOD 4 THEN ZeroPAD$ = SPACE$(4 - (BMPHead.PWidth MOD 4))

a$ = " "
u$ = " "

OUT &H3C8, 0
FOR Colr = 0 TO 255
GET #1, , a$: Blu = ASC(a$) \ 4
GET #1, , a$: Grn = ASC(a$) \ 4
GET #1, , a$: Red = ASC(a$) \ 4
OUT &H3C9, Red
OUT &H3C9, Grn
OUT &H3C9, Blu
GET #1, , u$ '--- unused byte
NEXT Colr

y = BMPHead.PDepth - 1

o$ = " "
GET #1, BMPHead.Offset, o$

p$ = " "

DO: x = 0
DO
GET #1, , p$
PSET (x, y), ASC(p$)
x = x + 1
LOOP WHILE x < BMPHead.PWidth

GET #1, , ZeroPAD$
y = y - 1

LOOP UNTIL y = -1
END SUB

SUB FourBIT '********************* 4 bit color screen 12 or 13 'Bob's Winbit

IF BMPHead.PWidth MOD 8 THEN ZeroPAD$ = SPACE$((8 - BMPHead.PWidth MOD 8) \ 2)

a$ = " "
FOR Colr = 0 TO NColors - 1
OUT &H3C8, Colr
GET #1, , a$: Blu = ASC(a$) \ 4
GET #1, , a$: Grn = ASC(a$) \ 4
GET #1, , a$: Red = ASC(a$) \ 4
OUT &H3C9, Red
OUT &H3C9, Grn
OUT &H3C9, Blu
GET #1, , a$ '--- unused byte
NEXT Colr

o$ = " "
GET #1, BMPHead.Offset, o$
y = BMPHead.PDepth - 1 'bottom screen row

a$ = " "

DO
x = 0
DO
GET #1, , a$

HiNIBBLE = ASC(a$) \ &H10 '\ 16
LoNIBBLE = ASC(a$) AND &HF 'AND 15

PSET (x, y), HiNIBBLE
x = x + 1
PSET (x, y), LoNIBBLE
x = x + 1
LOOP WHILE x < BMPHead.PWidth

GET #1, , ZeroPAD$
y = y - 1

LOOP UNTIL y = -1 'top screen row

END SUB

SUB GetInfo (TC$) 'get filename and display bitmap settings
SCREEN 12
Border 11
COLOR 13: LOCATE 4, 17: PRINT "BitMaP Full Screen BSAVER for Screens 12 or 13"
COLOR 10: LOCATE 7, 5: PRINT "This program loads Bitmaps to the screen according to the Color settings"
LOCATE 8, 5: PRINT "determined by the bitmap header BPP setting. It then converts the screen"
LOCATE 9, 5: PRINT "into a BSAVE file with the color settings indexed from the start of the"
LOCATE 10, 5: PRINT "image array created with GET. In Screen 12 the image is then indexed to"
LOCATE 11, 5: PRINT "Array(48) and Screen 13 is placed at Array(768). When the files are loaded"
LOCATE 12, 5: PRINT "using BLOAD, the graphics array holds the image after the color settings."
LOCATE 13, 5: PRINT "Just use PUT(x, y), Array(48) in Screen 12 or PUT(x, y), Array(768) in 13"
LOCATE 14, 5: PRINT "Load the image and use OUT &H3C9 to load the color settings of the BMP."
COLOR 12: LOCATE 17, 5: PRINT " Bitmap sizes limited to 640 X 480 in 12 and 320 X 200 in 13! "
COLOR 14: LOCATE 20, 5: PRINT "You are personally responsible for entering the proper name and path! "
LOCATE 21, 5: PRINT " This program will add the .BMP extension."
COLOR 11: LOCATE 24, 5: PRINT " After the image is loaded, wait for color scan."
LOCATE 25, 5: PRINT " Then press B key to BSAVE! Another key Aborts!"
COLOR 13: LOCATE 29, 35: PRINT "Press any Key!";
DO: LOOP UNTIL INKEY$ <> ""

CLS : COLOR 11
FILES "*.bmp"
SOUND 700, 3
COLOR 14: INPUT " Enter First part of a file name (Enter Quits): ", FileName$
CLS
IF LEN(FileName$) > 0 AND LEN(FileName$) < 9 THEN '1 to 8 character name
OpenName$ = UCASE$(FileName$) + ".BMP"
OPEN OpenName$ FOR INPUT AS #1 'check if file exists
CLOSE #1
ELSE : COLOR 12: LOCATE 15, 31: PRINT "Invalid File Name!": SLEEP: Closing: SYSTEM
END IF

IF FileErr = 0 THEN 'check for file exist error
OPEN OpenName$ FOR BINARY AS #1
ELSE : COLOR 12: LOCATE 15, 33: PRINT "File Not Found!": SLEEP: Closing: SYSTEM
END IF
GET #1, , BMPHead
IF BMPHead.ID <> "BM" THEN COLOR 12: LOCATE 15, 30: PRINT "File is Not a bitmap!": SLEEP: Closing: SYSTEM
Border 11
COLOR 11: LOCATE 2, 20: PRINT "Bitmap Header Information for "; UCASE$(FileName$); ".BMP"
COLOR 14
LOCATE 4, 20: PRINT "File Type ID = "; BMPHead.ID
LOCATE 5, 20: PRINT "Data file Size ="; BMPHead.Size
LOCATE 6, 20: PRINT "Offset of Pixel Data ="; BMPHead.Offset
LOCATE 7, 20: PRINT "Header Size ="; BMPHead.Hsize
LOCATE 8, 20: PRINT "Picture Width ="; BMPHead.PWidth
LOCATE 9, 20: PRINT "Picture Depth ="; BMPHead.PDepth
LOCATE 10, 20: PRINT "Number of Planes ="; BMPHead.Planes
LOCATE 11, 20: PRINT "Bits Per Pixel ="; BMPHead.BPP; " (1, 4, 8 or 24 bit)"
LOCATE 12, 20: PRINT "Compression ="; BMPHead.Compress; " (0 = not compressed)"
LOCATE 13, 20: PRINT "Image Byte Size ="; BMPHead.ImageBytes
LOCATE 14, 20: PRINT "Width in PELS ="; BMPHead.Xres
LOCATE 15, 20: PRINT "Depth in PELs ="; BMPHead.Yres
LOCATE 16, 20: PRINT "Number of COLORS ="; BMPHead.NumColors; " (normally 0) "
LOCATE 17, 20: PRINT "Significant Colors ="; BMPHead.SigColors; " (normally 0)"


IF BMPHead.BPP = 8 THEN
IF BMPHead.PWidth > 320 OR BMPHead.PDepth > 200 THEN CLS : COLOR 12: LOCATE 15, 30: PRINT "Bitmap too large!": SLEEP 3: SYSTEM
COLOR 11: LOCATE 20, 32: PRINT "Screen 13 Bitmap": Scr = 13
ELSE
IF BMPHead.PWidth <= 640 AND BMPHead.PDepth <= 480 THEN 'check for Screen 12 size
Scr = 12: COLOR 11: LOCATE 20, 30: PRINT "Screen 12 Bitmap"
ELSE : CLS : COLOR 12: LOCATE 15, 30: PRINT "Bitmap too large!": SLEEP 3: SYSTEM '?????
END IF
IF BMPHead.PWidth <= 320 AND BMPHead.PDepth <= 200 THEN 'check for Screen 13 size
SOUND 400, 3: COLOR 11: LOCATE 20, 30: PRINT "Screen 12 or 13? ";
DO: Scrn$ = INKEY$
IF Scrn$ = "1" AND used = 0 THEN PRINT "1": used = 1
IF Scrn$ = "2" OR Scrn$ = "3" THEN EXIT DO 'filter for 2 or 3 entry only
LOOP
Scr = VAL(Scrn$) + 10
COLOR 11: LOCATE 20, 30: PRINT "Screen"; Scr; "Bitmap "
END IF
IF BMPHead.BPP = 24 AND Scr = 13 THEN
SOUND 400, 3
COLOR 15: LOCATE 22, 18: PRINT "TrueColor Bitmap in Color or Greyscale? (C/G) ";
DO: SLEEP: TC$ = UCASE$(INKEY$): LOOP UNTIL TC$ = "C" OR TC$ = "G"
PRINT TC$
END IF
END IF
COLOR 10: LOCATE 25, 15: PRINT "Note: Once Displayed, Press B to BSAVE the bitmap!"
COLOR 13: LOCATE 28, 27: PRINT "Press any key to view Bitmap."
DO: SLEEP: LOOP UNTIL INKEY$ <> ""
CLS
SCREEN Scr 'set bitmap screen
END SUB

SUB GetRGB (Array()) 'puts the RGB settings into an Array(0 to 47 or 767)
FOR c = 0 TO NColors - 1
OUT &H3C7, c 'set attribute to read
Array(3 * c) = INP(&H3C9) 'get RGB color settings
Array((3 * c) + 1) = INP(&H3C9)
Array((3 * c) + 2) = INP(&H3C9)
NEXT c
END SUB

SUB OneBIT '********* Black and White can be tinted 'Winbit
BitsOver = BMPHead.PWidth MOD 32
IF BitsOver THEN ZeroPAD$ = SPACE$((32 - BitsOver) \ 8)

y = BMPHead.PDepth - 1
o$ = " "
GET #1, BMPHead.Offset, o$
a$ = " "

DO
x = 0
DO
GET #1, , a$
CharVAL = ASC(a$)
Bit = 128
FOR BitCOUNT = 1 TO 8
IF CharVAL AND Bit THEN PSET (x, y), 15 ELSE PSET (x, y), 0
Bit = Bit / 2
x = x + 1
NEXT BitCOUNT
LOOP WHILE x < BMPHead.PWidth
GET #1, , ZeroPAD$
y = y - 1
LOOP UNTIL y = -1
END SUB

SUB ScanBMP (Changed(), Image())
DIM xx AS LONG, yy AS LONG
ScanWidth& = BMPHead.PWidth
ScanDepth& = BMPHead.PDepth
IF Scr = 12 THEN
IF ScanWidth& > 640 THEN ScanWidth& = 640
IF ScanDepth& > 480 THEN ScanDepth& = 480
GET (232, 463)-(376, 479), Image(48)
COLOR Clr: LOCATE 30, 30: PRINT "Scanning";
ELSEIF Scr = 13 THEN
IF ScanWidth& > 320 THEN ScanWidth& = 320
IF ScanDepth& > 200 THEN ScanDepth& = 200
GET (112, 190)-(248, 199), Image(768)
COLOR Clr: LOCATE 25, 15: PRINT "Scanning";
END IF
FOR yy = 0 TO ScanDepth& - 1
FOR xx = 0 TO ScanWidth& - 1
Changed(POINT(xx, yy)) = 1
NEXT
IF yy MOD 100 = 0 THEN PRINT ".";
NEXT
IF Scr = 12 THEN LOCATE 30, 30: PRINT "Press B to BSAVE!";
IF Scr = 13 THEN LOCATE 25, 15: PRINT "Press B to BSAVE!";
END SUB

SUB TrueColor 'screen 13*****************Color 24 bit

IF ((BMPHead.PWidth * 3) MOD 4) THEN ZeroPAD$ = SPACE$((4 - ((BMPHead.PWidth * 3) MOD 4)))

OUT &H3C8, 0 'Ildurest's color palette
FOR i = 0 TO 251
OUT &H3C9, (i MOD 6) * 63 \ 5
OUT &H3C9, ((i \ 36) MOD 7) * 63 \ 6
OUT &H3C9, ((i \ 6) MOD 6) * 63 \ 5
NEXT

y = BMPHead.PDepth - 1

o$ = " "
GET #1, BMPHead.Offset, o$

a$ = " "
b$ = " "
c$ = " "

DO
x = 0

DO
GET #1, , a$
GET #1, , b$
GET #1, , c$
a = ASC(a$)
b = ASC(b$)
c = ASC(c$)
'Ildurest's formulas

'OPTION 1 FORMULA: Light colors
REM d = c * 5 \ 255 + (b * 6 \ 255) * 36 + (a * 5 \ 255) * 6

'OPTION 2 FORMULA: Bright colors
d = INT(SIN((c - 127.5) * ATN(1) * 2 / 127.5) * 2.99 + 3) + INT(SIN((b - 127.5) * ATN(1) * 2 / 127.5) * 3.49 + 3.5) * 36 + INT(SIN((a - 127.5) * ATN(1) * 2 / 127.5) * 2.99 + 3) * 6

'OPTION 3 FORMULA: Dark colors
REM d = INT(TAN((C - 127.5) * ATN(1) / 127.5) * 2.99 + 3) + INT(TAN((B - 127.5) * ATN(1) / 127.5) * 3.49 + 3.5) * 36 + INT(TAN((A - 127.5) * ATN(1) / 127.5) * 2.99 + 3) * 6

PSET (x, y), d
x = x + 1

LOOP WHILE x < BMPHead.PWidth

GET #1, , ZeroPAD$
y = y - 1

LOOP UNTIL y = -1
END SUB

SUB TrueGrey 'screen 12 or 13 ****** greyscale 24 bit Bob's Winbit

IF ((BMPHead.PWidth * 3) MOD 4) THEN ZeroPAD$ = SPACE$((4 - ((BMPHead.PWidth * 3) MOD 4)))

IF Scr = 13 THEN
FOR Colr = 0 TO 255 STEP 4
FOR Reps = 0 TO 3
OUT &H3C8, Colr + Reps
OUT &H3C9, n
OUT &H3C9, n
OUT &H3C9, n
NEXT Reps
n = n + 1
NEXT Colr
div = 3
ELSEIF Scr = 12 THEN
n = 3
FOR Colr = 0 TO 15
OUT &H3C8, Colr
OUT &H3C9, n
OUT &H3C9, n
OUT &H3C9, n
n = n + 4
NEXT Colr
div = 48
END IF


y = BMPHead.PDepth - 1

o$ = " "
GET #1, BMPHead.Offset, o$

a$ = " "
b$ = " "
c$ = " "

DO: x = 0
DO
GET #1, , a$
GET #1, , b$
GET #1, , c$
a = ASC(a$)
b = ASC(b$)
c = ASC(c$)
d = (a + b + c) \ div

PSET (x, y), d
x = x + 1

LOOP WHILE x < BMPHead.PWidth

GET #1, , ZeroPAD$
y = y - 1

LOOP UNTIL y = -1

END SUB













BLOADER (a subroutine in my main program)

SUB LoadImage (file$, col, row, numf)
DIM Image(0 TO 26000) AS INTEGER
n = 4
MaxColors = 256
DEF SEG = VARSEG(Image(0))
IF numf = 2 THEN
Prows = 100
FOR y = 0 TO Prows STEP 100
n = n + 1
BLOAD file$ + LTRIM$(STR$(n)) + ".BSV", VARPTR(Image(0))
PUT (col, row + y), Image(768), PSET
NEXT y
ELSE
BLOAD file$, VARPTR(Image(0))
PUT (col, row), Image(768), PSET
END IF
DEF SEG
OUT &H3C8, 0
FOR c = 0 TO (MaxColors * 3) - 1
OUT &H3C9, Image(c)
NEXT c
END SUB

Posted on May 30, 2013, 2:44 PM

Respond to this message   

Return to Index


Every bitmap has its own color palette set using OUT

by (Login burger2227)
R

So one bitmap may use a red color for COLOR 2 while the next one uses it for green. The bitmap colors may also affect the printed text colors on the screen too.

When you use Qbasic legacy screens they require some bitmaps to set the colors different than others. Thus when you use OUT to set the next images palette it may change the previous image color intensities too.

The only way around this is to use 24/32 bit screen modes like QB64 has. Those kinds of image files set every pixel to a unique color with a byte going to each one to set the Red, Green and Blue. This makes each pixel take 3 bytes to render each pixel.

QB64 can also allow you to set the transparency of some colors too.

I did make an editor that can reassign the colors to other attributes in SCREEN 12 only. I had to change them for a deck of cards I had downloaded where some cards used the same attribute number for different colors.

If you are making the sprites for a game then you need to use the same OUT color settings for every image you create. Otherwise use 32 bit.

Posted on May 30, 2013, 7:21 PM

Respond to this message   

Return to Index


Default palette?

by Brian (no login)

Why does the bitmap image have to change the palette? Can't the colors just be changed to the best match out of the default 256 color palette?

Posted on May 31, 2013, 4:46 PM

Respond to this message   

Return to Index


A couple of questions (Clippy, Pete) regarding QBG in QB64...

by (Login qb432l)
R

I've actually started converting it, and it's going better than I anticipated. The QB64 mouse routines are a snap (Search/Change) and everything else is being handled well by QB64. I currently have the first three lessons in a QB64 executable. Wow.

For Clippy: If/when I finish this and put in in a zip file, what files/directories do I need to include for QB64? I'm currently using 0.954 (I believe it is the latest).

For Pete: Even if I concatenate all the CHAIN files, thus eliminating redundant code, etc., it will still be a pretty big zip file. Will I have to create two zip files again, or have Network54 size restrictions changed?

-Bob

Posted on May 30, 2013, 12:53 PM

Respond to this message   

Return to Index


First of all, it's Pete, Clippy...

by Pete (Login The-Universe)
Admin

Let's do one zip file, and if it doesn't fit N54, I'll host it someplace else and link back to it. No problem.

I'd compile it in the GL version of QB64. Those are stand-alone exe files. No need for the other crap, excuse me, supportive files... oh wait, yes, I meant crap.

Pete

Posted on May 30, 2013, 12:57 PM

Respond to this message   

Return to Index


lol - Usually Clippy is first to respond, sorry...

by (Login qb432l)
R

Explain "GL" -- is it just another download or do I need to learn new stuff ($#%!!).

-Bob

Posted on May 30, 2013, 1:00 PM

Respond to this message   

Return to Index


QB64-GL

by Pete (Login The-Universe)
Admin

It's the latest version, which breaks from relying on SDL as the display software. It uses Open GL, which allows the source code to compile into a single stand-alone exe, like QuickBasic and PDS. I recommend you just keep writing the code, and when finished, download the GL version, and just hit compile. It should take all the code. It is almost 100% compatible. I mean it compiled my 80,000 line program, no problem.

Pete

Posted on May 30, 2013, 1:09 PM

Respond to this message   

Return to Index


*Thanks! (Sorry Clipster - the early bird... well, you know, is usually a Republican.).

by (Login qb432l)
R

*

Posted on May 30, 2013, 1:16 PM

Respond to this message   

Return to Index


Oh Clippy was here first...

by Pete (Login The-Universe)
Admin

But like a good Republican, I told the goons at Network54 to not let him log in. without a valid voter ID card.

Pete happy.gif

Posted on May 30, 2013, 1:19 PM

Respond to this message   

Return to Index


Woooow

by Brian (no login)

I think I just put two and two together.. are you the Pete from petesqbsite.com? :O or is it just a coincidence?

Posted on May 30, 2013, 1:42 PM

Respond to this message   

Return to Index


No, I'm an imposter.

by Pete (Login The-Universe)
Admin

But I'm much better looking, so I can live with it.

Pete happy.gif

Posted on May 30, 2013, 2:23 PM

Respond to this message   

Return to Index


Re: No, I'm an imposter.

by Brian (no login)

I haven't known you guys very long, and you've all known each other since the stone age, so I can't tell if you're being sarcastic or not :P

Posted on May 30, 2013, 2:26 PM

Respond to this message   

Return to Index


*I never kid about my good looks.And that's the Stoned Age, circa 1970s

by Pete (Login The-Universe)
Admin

Posted on May 30, 2013, 4:20 PM

Respond to this message   

Return to Index


* Handsome QUACK!

by (Login burger2227)
R

Posted on May 30, 2013, 6:51 PM

Respond to this message   

Return to Index


Straight answer Brian: no, our Pete is not the Pete from petesqbsite...

by (Login qb432l)
R

He does, however, own this forum. I've been meaning to mention to him that since others have made the same mistake, he should consider changing his handle to something like Superman, so there'd be no more confusion.

Oops! Make that Clark Kent.

-Bob

Posted on May 30, 2013, 5:00 PM

Respond to this message   

Return to Index


* Screw you... Bruce!

by Superman (Login The-Universe)
Admin

Posted on May 30, 2013, 5:09 PM

Respond to this message   

Return to Index


*Wow! Not THE Superman!?

by (Login qb432l)
R

*

Posted on May 30, 2013, 5:42 PM

Respond to this message   

Return to Index


*Nope, it wasn't me. Must be an imposter as I'm the only Superman here...

by SMcNeill (no login)

Posted on Jun 2, 2013, 7:07 PM

Respond to this message   

Return to Index


Superman gets his butt kicked all the time...

by Perry the Platypus (Login The-Universe)
Admin

That's why he has a red "S".

Send all viewer complaints to:

- Clippy is Evil Incorporated



Posted on Jun 2, 2013, 7:42 PM

Respond to this message   

Return to Index


GL may not be ready for it. Here's the DLL ZIP file link

by (Login burger2227)
R

Posted on May 30, 2013, 6:48 PM

Respond to this message   

Return to Index


Any way to load a BMP and save it to a BSV? (@TheBOB) v2

by Brian (no login)

Reposting this

OP: Hey guys, I made around 20 sprites that I want to use in my program. I'm only a first year programmer and my teacher barely touched on the basics of graphics so I really don't know anything about BLOADing / BSAVEing / GETing / PUTing ect. All I am looking for is a simple 24-bit bmp loader that will load the image but then convert it to a BSV file so I can BLOAD it in my program later. The program also needs to be QB45 compatible (if possible). I've been told that someone named "TheBOB" knows a lot about this stuff and I've seen some of his tutorials, they are great

Thanks everyone,
Brian


So in that post I made, I made a mistake. I do not care if the images are 24-bit, The 256 colors that SCREEN 13 is personally good enough for my program. Also, if the images can't be converted into BLOAD, then could it be put inside of a DATA statement or an array? I just need to get these images loaded into my program and they need the ability to be taken off the screen and back on easily

Thanks again,
Brian

Posted on May 29, 2013, 12:02 PM

Respond to this message   

Return to Index


In that case, there's no problem...

by (Login qb432l)
R

If you're working in QB4.5 already, you should be able to load my tutorial -- Pete mentioned you were having problems with that.

Included in the QBG1 and QBG2 zips, is a bitmap loader that will load SCREEN 13 images in 8-bit (256 colors). BSAVE'ing and BLOAD'ing is extremely simple and will give you everything you need -- including the possibility of GET'ing all the individual sprites to a single array, and PUT'ing them using array indexing.

Is it really not possible to run my tutorial? All of this is explained in detail.

-Bob

Posted on May 29, 2013, 12:10 PM

Respond to this message   

Return to Index


QBG2.EXE runs fine on my XP

by (Login burger2227)
R

Hope he is not clicking on the icon. I did that when I first tried to run it. LOL

Posted on May 29, 2013, 12:13 PM

Respond to this message   

Return to Index


You must have XP 32-bit...

by (Login qb432l)
R

On my XP machine (64-bit) I could only run QB text mode programs. If I were Pete, I never would've noticed the difference.

-Bob

Posted on May 29, 2013, 12:19 PM

Respond to this message   

Return to Index


Yup

by Brian (no login)

Yeah I can run your tutorials, I can try with DOS but I have a 64-bit computer with windows 7 and it doesn't work. I could also try and run them tomorrow at school

Posted on May 29, 2013, 12:16 PM

Respond to this message   

Return to Index


Sounds good...

by (Login qb432l)
R

Let me know how it works out. If you can wait a month or two, I should have my tutorial working in QB64 in which case Windows 7 won't be a problem. Mind you, your QB4.5 programs still won't work there -- only under DOSBox.

-Bob

Posted on May 29, 2013, 12:22 PM

Respond to this message   

Return to Index


* Drink less and code more...

by (Login burger2227)
R

Posted on May 29, 2013, 5:07 PM

Respond to this message   

Return to Index


I'm pretty proud of Clippy for being able to stop drinking.

by Pete (Login The-Universe)
Admin

Not an easy habit to break. I bet everyone thought that kicking that habit would make him less of a hard-ASCII. Not me. Hell, he only stopped drinking, not breathing!

Pete happy.gif

Posted on May 29, 2013, 10:12 PM

Respond to this message   

Return to Index


You will need to use QB64. Windows 64 bit has no DOS.

by (Login burger2227)
R

32 bit XP has NTVDM to emulate DOS. Windows 7 needs QB64 to compile your code. As Bob already stated, he will have to convert the tutorials to run on 64 bit machines.

I have some programs that can be used to make and view BSAVE files if you want to download them.

https://dl.dropboxusercontent.com/u/8440706/Bitmaps.zip

Posted on May 29, 2013, 12:23 PM

Respond to this message   

Return to Index


Thanks

by Brian (no login)

Thank you, is there any easier way to BLOAD the image back without using "BLOADANY" ? That seems like a lot of code just to load one image

Posted on May 29, 2013, 12:42 PM

Respond to this message   

Return to Index


Use the code any way you want

by (Login burger2227)
R

The SUB programs have the code you need. The image colors are saved to the BSAVE files first. Then the image information follows.

QB64 can load image files directly. It also allows you to display 24 bit colors. _LOADIMAGE loads the image to a handle value that you can use to reference the image.

http://qb64.net/wiki/index.php?title=LOADIMAGE

Otherwise you may need to use Paint to set the colors to 256 for SCREEN 13.



Posted on May 29, 2013, 3:53 PM

Respond to this message   

Return to Index


Simple BLOADer doesn't work with your files?

by Brian (no login)

I used your BSAVEr to save a few images. These images were stored as .B13 files and when I tried to later load them with this simple loader:

DEF SEG = VARSEG(Image%(0))
BLOAD "Image1.B13", VARPTR(Image%(0))
PUT (50, 50), Image%(0), PSET
DEF SEG

Nothing shows up, I'm assuming I need something a lot more complicated than this.

Posted on May 29, 2013, 5:12 PM

Respond to this message   

Return to Index


Image is the GET and PUT array

by (Login burger2227)
R

It needs to be an integer array and you have to PUT the array index based on the number of colors. 16(SCREEN 12) colors uses index 3 * 16 = 48 and 256(SCREEN 13) uses 3 * 256 = 768.

DIM Image(26000) AS INTEGER

DEF SEG = VARSEG(Image%(0))
BLOAD "Image1.B13", VARPTR(Image%(0))
PUT (50, 50), Image%(768), PSET
DEF SEG

You have to set the palette colors using OUT with the values at the start of the array from Image%(0). 24 bit colors will not work in QB.

Can you get them to load with BLOADANY? Colors OK?

Posted on May 29, 2013, 5:34 PM

Respond to this message   

Return to Index


Re: Image is the GET and PUT array

by Brian (no login)

BLOADANY works fine, it's just too much code to incorporate into my program, it's also really advanced for me and I have no clue what is even happening. That code you just gave me:

DIM Image(26000) AS INTEGER

DEF SEG = VARSEG(Image%(0))
BLOAD "Image1.B13", VARPTR(Image%(0))
PUT (50, 50), Image%(768), PSET
DEF SEG

works but the colors are screwy, you said something about setting the palette colors using OUT? I don't know how to do that, if you could give me a sample that would be great :)

Posted on May 29, 2013, 6:04 PM

Respond to this message   

Return to Index


Add this

by (Login burger2227)
R

MaxColors = 256

OUT &H3C8, 0 'set bitmap colors
FOR c = 0 TO (MaxColors * 3) - 1 'colors 0 to 255
OUT &H3C9, Image(c) 'set palette to first 768 in array
NEXT c


Here is a SUB for 256 colors in SCREEN 13:

SUB LoadImage13 (file$, col, row, numf) 'Screen 13 only!
n = 4
MaxColors = 256
DEF SEG = VARSEG(Image(0))
IF numf = 2 THEN
Prows = 100
FOR y = 0 TO Prows STEP 100 '2 files 5, 6.BSV
n = n + 1
BLOAD file$ + LTRIM$(STR$(n)) + ".BSV", VARPTR(Image(0))
PUT (col, row + y), Image(768), PSET ' Put the bitmap on the screen.
NEXT y
ELSE
BLOAD file$, VARPTR(Image(0))
PUT (col, row), Image(768), PSET ' Put the bitmap on the screen.
END IF
DEF SEG
OUT &H3C8, 0 'set bitmap colors
FOR c = 0 TO (MaxColors * 3) - 1 'colors 0 to 255
OUT &H3C9, Image(c) 'set palette to first 768 indices in array
NEXT c
END SUB

file$: the BSAVE file or first name without number 5 or 6 if 2 are used
col, row: coordinates to put top left corner of image
numf: The number of BSAVE files required for the image.

SCREEN 13 can use one file for almost the entire screen. MaxColors = 256

SCREEN 12 needs 3 files for the entire screen. MaxColors = 16 They will be sequentially numbered.

Posted on May 29, 2013, 7:15 PM

Respond to this message   

Return to Index


Subscript out of range?

by Brian (no login)

says the subscript on this line is out of range

BLOAD file$, VARPTR(Image(0))

Posted on May 29, 2013, 7:29 PM

Respond to this message   

Return to Index


DIM SHARED Image(0 TO 26000) AS INTEGER

by (Login burger2227)
R

You need a SHARED the array with the SUB

Posted on May 29, 2013, 7:31 PM

Respond to this message   

Return to Index


* Dimmit! You beat me to it!

by Pete (Login The-Universe)
Admin

Posted on May 29, 2013, 7:32 PM

Respond to this message   

Return to Index


LOL

by (Login burger2227)
R

I'm a winner...

Posted on May 29, 2013, 7:36 PM

Respond to this message   

Return to Index


Another error

by Brian (no login)

Ok so this time it actually sets the image on the screen where I want it, but then it still says that the subscript is out of range on line 32 [ BLOAD file$, VARPTR(Image(0)) ]
At the point that the error occurs, the image is already on the screen, so do I even need the code from that line down? Also, I really appreciate the help that you and everyone else on this forums have given me.

SCREEN 13

DIM Image(0 TO 26000) AS INTEGER

DEF SEG = VARSEG(Image%(0))
BLOAD "M11.B13", VARPTR(Image%(0))
PUT (200, 50), Image%(768), PSET
DEF SEG

MaxColors = 256

OUT &H3C8, 0 'set bitmap colors

FOR c = 0 TO (MaxColors * 3) - 1 'colors 0 to 255
OUT &H3C9, Image(c) 'set palette to first 768 in array
NEXT c

CALL LoadImage13(file$, col, row, numf)

SUB LoadImage13 (file$, col, row, numf) 'Screen 13 only!
n = 4
MaxColors = 256
DEF SEG = VARSEG(Image(0))
IF numf = 2 THEN
Prows = 100
FOR y = 0 TO Prows STEP 100 '2 files 5, 6.BSV
n = n + 1
BLOAD file$ + LTRIM$(STR$(n)) + ".BSV", VARPTR(Image(0))
PUT (col, row + y), Image(768), PSET ' Put the bitmap on the screen.
NEXT y
ELSE
BLOAD file$, VARPTR(Image(0))
PUT (col, row), Image(768), PSET ' Put the bitmap on the screen.
END IF
DEF SEG
OUT &H3C8, 0 'set bitmap colors
FOR c = 0 TO (MaxColors * 3) - 1 'colors 0 to 255
OUT &H3C9, Image(c) 'set palette to first 768 indices in array
NEXT c
END SUB

Posted on May 29, 2013, 7:40 PM

Respond to this message   

Return to Index


Try this

by (Login burger2227)
R

SCREEN 13

CALL LoadImage13("M11.B13, 200, 50, 1)

END

SUB LoadImage13 (file$, col, row, numf) 'Screen 13 only!
DIM Image(0 TO 26000) AS INTEGER 'use DIM SHARED outside of SUB
n = 4
MaxColors = 256
DEF SEG = VARSEG(Image(0))
IF numf = 2 THEN
Prows = 100
FOR y = 0 TO Prows STEP 100 '2 files 5, 6.BSV
n = n + 1
BLOAD file$ + LTRIM$(STR$(n)) + ".BSV", VARPTR(Image(0))
PUT (col, row + y), Image(768), PSET ' Put the bitmap on the screen.
NEXT y
ELSE
BLOAD file$, VARPTR(Image(0))
PUT (col, row), Image(768), PSET ' Put the bitmap on the screen.
END IF
DEF SEG
OUT &H3C8, 0 'set bitmap colors
FOR c = 0 TO (MaxColors * 3) - 1 'colors 0 to 255
OUT &H3C9, Image(c) 'set palette to first 768 indices in array
NEXT c
END SUB

Posted on May 29, 2013, 7:49 PM

Respond to this message   

Return to Index


Awesome

by Brian (no login)

Sweet, it works great. One last question, do the files that I'm loading (ex. "M11.B13") have to be within the same folder as QBasic, or can the file be located anywhere? (a.k.a. a flash drive)

Posted on May 29, 2013, 7:53 PM

Respond to this message   

Return to Index


The files can be located anywhere, but...

by Pete (Login The-Universe)
Admin

You have to reference them if they are outside the dir QB is running in.

Pete

Posted on May 29, 2013, 8:07 PM

Respond to this message   

Return to Index


I would not reference them on an external drive

by (Login burger2227)
R

You can put a full path or a sub folder path to the files in the name. Otherwise use CHDIR to move the program to the folder.

Posted on May 29, 2013, 8:22 PM

Respond to this message   

Return to Index


Thank you all

by Brian (no login)

Alrighty, thanks everyone for the help :). I couldn't have done it with out you guys. The BSAVER works perfectly, and your loader works awesome with my program.

Finally, before I crash for tonight, I'm 99.99% sure transparency is not possible in QB (at least QB45 anyways), so is there any way to remove the white box around my sprite? This really isn't a big deal fo what I am doing, but for future reference it would be nice to know

Posted on May 29, 2013, 8:39 PM

Respond to this message   

Return to Index


Yes, PUT with AND can make white clear

by (Login burger2227)
R

Problem is that everything white will be clear and everything else must be black to be seen over the mask. It would be better if the background was the only color that was black. Other black areas could be made dark as color 8, dark grey in the original image.

You need to make a mask image and place the mask with PUT with AND over a colored or black background.

http://qb64.net/wiki/index.php?title=Creating_Sprite_Masks

Scan the image and PSET black or white only for the mask. Normally black is just changed to white to make that part clear.

DIM mask(wide * high) AS INTEGER 'multiply dimensions to find array size

FOR xx = minX TO maxX
FOR yy = minY TO maxY
clr = POINT(xx, yy)
IF clr = 0 THEN PSET (xx, yy), 15 ELSE PSET (xx, yy), 0
NEXT yy
NEXT xx
GET (minX, minY)-(maxX, maxY), Mask(0)

You have to GET the mask image to index it into an array or a separate array and PUT it with the AND action. Then PUT the original image over top at the same PUT coordinates.

QB64 can set ALPHA transparency in 24/32 bit screens too, but if other parts of the image are the same exact color they would be clear too.

Posted on May 29, 2013, 9:49 PM

Respond to this message   

Return to Index


Re: Yes, PUT with AND can make white clear

by Brian (no login)

Well, that's good to know, I have less than a week left to fiish my project so I don't really need to worry about it this time. Also, I tested loading all of my sprites and they all worked fine ...until the last one. It's kinda hard to explain so heres what it's supposed to look like (without sprite)

http://gyazo.com/cf3c4b6a6525fe0fa1268adc83b6408b

And here's what happens when I load the sprite

http://gyazo.com/bb6fb522cd1c62e4b52dc121818d09aa

As you can see, the inner circle turns to red. Anybody knows why this happens / how to fix it?

Thanks,
Brian

Posted on May 30, 2013, 1:29 PM

Respond to this message   

Return to Index


24bit BMPs on QBasic

by Ben (no login)

Do you happen to have any insight on other methods of displaying 24bit BMPs in 256 colors other than greyscale? Perhaps algorithm to find a few common colors and make shades of them, squeeze them into the palette as accurate as possible in terms of colors. Or dithering. I've attempted before to write monochrome dithering function, it works somewhat but incomplete.

There's also SVGA, on which you can use higher modes than what SCREEN offers. But that may be impractical if QB64 is a sufficient alternative.

Posted on May 29, 2013, 11:43 PM

Respond to this message   

Return to Index


Ildurest made a 24 bit simulator that gave some of the colors

by (Login burger2227)
R

I added it to one of TheBob's bitmap programs called WINBIT.

QB64 does it the right way!

Posted on May 30, 2013, 3:27 AM

Respond to this message   

Return to Index


Any way to load a BMP and save it to a BSV? (@TheBOB)

by Brian (no login)

Hey guys, I made around 20 sprites that I want to use in my program. I'm only a first year programmer and my teacher barely touched on the basics of graphics so I really don't know anything about BLOADing / BSAVEing / GETing / PUTing ect. All I am looking for is a simple 24-bit bmp loader that will load the image but then convert it to a BSV file so I can BLOAD it in my program later. The program also needs to be QB45 compatible (if possible). I've been told that someone named "TheBOB" knows a lot about this stuff and I've seen some of his tutorials, they are great

Thanks everyone,
Brian

Posted on May 28, 2013, 7:32 PM

Respond to this message   

Return to Index


Look in the downloads section

by (Login burger2227)
R

The Bob has tutorials there.

QB64 can load them too, but you don't need to do that as QB64 can load images directly.

Posted on May 28, 2013, 9:47 PM

Respond to this message   

Return to Index


He did. He's asking Bob here because...

by (Login The-Universe)
Admin

He can't get the tutorials to work on his computer. he already downloaded them, and tried.

Pete

Posted on May 28, 2013, 9:50 PM

Respond to this message   

Return to Index


Well he can't load 24 bit bitmaps in Qbasic. Need QB64 to do that.

by (Login burger2227)
R

QB64 can without BSAVE and BLOAD. Qbasic does not have a 24 bit screen mode.

Posted on May 28, 2013, 11:17 PM

Respond to this message   

Return to Index


Sorry you can't run the tutorials...

by (no login)

They were written in QBasic and contain graphics, which means they will only run under Windows XP (32 bit) or earlier, or using DOSBox.

Clippy's right about QB64. In QBasic, bitmaps have to be 16-bit color or less to load, and even then they're only 320x200 (SCREEN 13). 24-bit only load in grayscale. With QB64 you can load the bitmaps directly at any screen resolution. More importantly to you, all QBasic commands are recognized, which means you won't have to learn another language, only a few additional commands. BSAVE and BLOAD, as well as Graphical GET and PUT, work fine in QB64, so you can convert your bitmaps to sprite arrays and continue from there. In addition, memory size and speed aren't a problem as with QB

If you want to pursue this in QB64, post again.

-Bob



Posted on May 29, 2013, 3:50 AM

Respond to this message   

Return to Index


Bob. Ever thought about re-compiling tuts into QB64?

by Pete (Login The-Universe)
Admin

I know you don;t include the source in the zips, or I'd do it myself, but if you have any interest in making the QB45 exe files into QB64 exe files, I could include the new zip in the download folder, and label them appropriately. Up to you... no pressure... a lot of people, probably like 3... but that's a lot for here... are counting on you. Just kidding, but if Rob ever gets it together and markets (advertises) QB64, I'm sure of one thing. The newbies today are mostly interested in graphics, not SCREEN 0 applications. Well now see what you've done, That made me sad. sad.gif Oh well, you're loss. That bottle of Jack I picked up for you in the Community forum, I'm glugging it down right now!

Pete

Posted on May 29, 2013, 9:51 AM

Respond to this message   

Return to Index


As a matter of fact...

by (Login qb432l)
R

When responding to the OP, I was thinking that very thing. Sounds like a worthwhile summer project (even if only 3 people get something out of it). It'll be a bit of work, since I'll have to combine all the files into a single executable. As it is, there are quite a few CHAIN'ed .EXE's and that wouldn't be necessary in QB64 (or elegant).

Of course, much of this depends on whether there's any of my whiskey left. I need a little Tennessee sour mash to inspire me from time to time.

-Bob

Posted on May 29, 2013, 11:25 AM

Respond to this message   

Return to Index


Better stock up! You will need to fix the mouse.

by (Login burger2227)
R

Absolute does not have the full range of functions in QB64. Something I wish that Galleon had finished long ago at least for old mouse routines.

_MOUSEMOVE can be used in QB64 for that function however.

Posted on May 29, 2013, 11:57 AM

Respond to this message   

Return to Index


Yeah...

by (Login qb432l)
R

In considering the project, I knew I'd have to replace all that CALL ABSOLUTE stuff with QB64 mouse commands. Fortunately, the mouse is only used to navigate the menu and click the forward/back buttons.

-Bob

Posted on May 29, 2013, 12:04 PM

Respond to this message   

Return to Index


Or you could switch it to call interrupt.

by Pete (Login The-Universe)
Admin

My CALL INTERRUPT routines still work in QB64.

Pete

Posted on May 29, 2013, 12:58 PM

Respond to this message   

Return to Index


Possible, but sooner or later I have to get used to QB64's mouse routines...

by (Login qb432l)
R

I have to ask myself if CALL INTERRUPT will eventually go the way of CALL ABSOLUTE. Maybe not, but the learning curves get higher every year, and I find myself throwing up my hands with less and less provocation. Back in the days when there were still so many things I wanted to try, they weren't learning curves, they were new and exciting possibilities.

It can't be an age thing, because I'm pretty sure it was just a couple of years ago that I turned 30.

-Bob

Posted on May 29, 2013, 2:41 PM

Respond to this message   

Return to Index


You turned 30, I remember that day...

by Pete (Login The-Universe)
Admin

I was cranky, but that's because mom forgot to burp me!

Pete happy.gif

- Left myself W/O for Clippy on that one.


Seriously, I know exactly what you mean. 30 years ago, I wouldn't let the AAA change my tire. 5 years ago, I'd call the AAA to change my tire. As of 5 days ago, I don't even want to make the phone call.

Posted on May 29, 2013, 2:46 PM

Respond to this message   

Return to Index


* In QB64, Interrupt and Absolute only work up to function 3

by (Login burger2227)
R

Posted on May 29, 2013, 3:41 PM

Respond to this message   

Return to Index


* I'd know that, if only we had a WIKI on this site!

by Pete (Login The-Universe)
Admin

Posted on May 29, 2013, 7:31 PM

Respond to this message   

Return to Index


That sure would be nice

by (Login GarryRicketson)
R

I would be happy to see it for qb64,..if it would help, I can send you a bottle. JackDaniels ?,..or what do you prefer?
Seriously though, it would be nice to see a qb64 version of your tutorial

Posted on May 29, 2013, 10:05 PM

Respond to this message   

Return to Index


How to Send Display to Text File?

by (no login)

Nearly twenty years ago, back when I was still able to spend hours at my computer, I cobbled together a QuickBasic 4.5 program called SEEFIRST that displayed the first x number of lines of text from all the text files in a single directory.

The display could be paged up or down, using the PageUp and PageDown keys,

It also showed the filenames that the lines of text were extracted from.

This program was my way of coming up with a makeshift substitute for long filenames in MS-DOS 6.21.

I compiled the program into an EXE file which I recently dug it out and have started using again (but only after tracking down a DOS configuration issue that caused my old QB program to fail).

The program is a great help to me in sorting through old text files (including BAT and BAS files) because I can put header lines at the top of the files telling me what the files contain.

What my program SEEFIRST program lacks, however, is the ability to open a file, once I find the one I'm looking for. So, I it occurred to me that if I could redirect the display output of the program into a text file that I could then open with my DOS text editor, I could then just select and copy a file name from the list in that file, and then paste the filename into the "Open File" field of the text editor, and voilĂ ! I can use my MS-DOS text editor as a kind of file manager with an ersatz long filename capability.

I'm not sure which BAS file I compiled my SEEFIRST.EXE from, but I think it may have been the one I posted here last December:

http://tinyurl.com/SEEFIRST-BAS

http://www.network54.com/Forum/648955/message/1356620842/Here%27s+the+code+for+my+old+SEEFIRST-BAS+program

I've ordered a QuickBasic manual which should turn up in a week or so, and then I'm going to try to figure out how to turn the display output into a text file.

I'm sure that I'll be checking back here for help once I start on this project, so I thought I'd give you all a heads up.

Will in Seattle
a.k.a. "Clueless"
Running QuickBasic 4.5
Under MS-DOS 6.21
(and DOSSHELL!)


Posted on May 25, 2013, 8:42 AM

Respond to this message   

Return to Index


Experiment with these....

by Pete (Login The-Universe)
Admin

SHELL "command /c start notepad"

or

SHELL "start notepad"

or SHELL "command /c notepad"

or even

SHELL "cmd /c start notepad"

If any of those open notepad, them you can use it to display a text file, by just making the PRINT statements print to file statements.

OPEN "myfile.txt" for output as #1
print #1, "my message here."
close #1

shell "command /c start notepad myfile.txt"
end

Posted on May 25, 2013, 8:59 AM

Respond to this message   

Return to Index


SHELL "cmd /c start notepad /p file.txt" to use USB printer

by (Login burger2227)
R

SHELL "cmd /c start notepad /p file.txt"

Posted on May 25, 2013, 1:06 PM

Respond to this message   

Return to Index


How to run .BAS file from DOS command lilne

by Clueless in Seattle (no login)

I'm sure I asked this question here a while back, but I'm afraid I've forgotten the answer.

I'm testing some of my old .BAS files by trying to run them from the MS-DOS command line with the /run option.

But the program display just flashes across the screen so fast I can't even see what is and then I get dumped back to the MS-DOS command prompt.

What's the trick to getting the program to stay up and running on the screen when I run it from the DOS prompt?

Will in Seattle
a.k.a. "Clueless"

Posted on May 24, 2013, 7:04 PM

Respond to this message   

Return to Index


QB/RUN File.bas

by (Login GarryRicketson)
R

I don't think a .bas command will run from the prompt, it needs to be a compiled .exe
Are you thinking of a .bat ?
You could make a .bat file that runs qb or qbasic,.. When you make a batch file all you need to do is type in the name, in this case
PLAY
and it will run.
Here is a example:
This is:(file name): PLAY.BAT
qb/run playtune.bas
---------

This is the .bas:
PLAYTUNE.BAS (filename)
PLAY "abcdefg"
-------------------
Just write your batch file, it could be any name you want, in the batch file, write in the line:
QB/RUN nameofyour.bas
--------------
Depending on your qbasic program, you might have to say QBASIC instead of QB.
You don't have to make a batch file.
Just type:
QB/RUN nameofthe.bas
at the command prompt. This is assumeing you are in the directory where qbasic is, and that the .bas file is in the same dir, other wise you would need to write the correct path, or use CD (to the dir where qbasic and the .bas are) also. Hope this makes sense, pretty simple, but I seem to complicate things when I try to explain.
So in that sense, you can rune a .bas program from the command line, but you need to start qbasic, first,type ( QB )or (QBASIC) then /RUN FILE.BAS
Note the first couple of times, I got the same results, it just kind of flashed by on the screen, but never ran,it turned out I was useing the wrong name, for my .bas file, I was saying PLAY.BAS, and there is no PLAY.BAS, it is PLAYTUNE.BAS . so make sure you have the filename right, and that it is on the dir you are working in.

Posted on May 24, 2013, 7:49 PM

Respond to this message   

Return to Index


Are you using QB64?

by (Login MCalkins)
Moderator

If so, replace SYSTEM with END.

Or else, make your programs console programs with:

$CONSOLE
_DEST _CONSOLE
_SOURCE _CONSOLE

However, the console concept in QB64 is flawed (it has been confused with standard i/o streams).

Regards,
Michael

Posted on May 24, 2013, 8:44 PM

Respond to this message   

Return to Index


Oops!

by (no login)

I should have told you that I'm running QuickBasic 4.5 under MS-DOS 6.21.

And I thought that some time ago someone in this group had told me how to run QuickBasic program from the MS-DOS command prompt like this:

QB /RUN program.bas

That seems to work (sort of). But the display of the program flashes across the screen in a millisecond and then I end up back at the DOS prompt.

I want to have the display of the program remain on the screen so that I can play with it (e.g. test to make sure the PageUp and PageDown keys scroll the program's display up and down, etc.)

Will in Seattle
a.k.a. "Clueless"

P.S. I've been posting in this forum off-and-on for quite a while and never noticed until you pointed it out to me, Michael, that this forum is supposed to be for QB64. My cognitive impairment has apparently reached the point where the numerals in "Network54" and "QB64" simply looked exactly alike to me. Duh! Until you mentioned it, I didn't even know that there was a QB64. Double Duh!

Posted on May 25, 2013, 7:13 AM

Respond to this message   

Return to Index


Add a pause before the end

by Solitaire (Login Solitaire1)
S

Just before the last END statement, add either:

INPUT "", something

which will pause until the user presses the Enter key

or

me$ = INPUT$(1)

which will pause until the user presses any key.

Posted on May 25, 2013, 8:34 AM

Respond to this message   

Return to Index


Re: Oops!

by (Login MCalkins)
Moderator

This forum is for both QBASIC and QB64. QuickBASIC is close enough to QBASIC that it fits in also.

It sounds like you are terminating the program when you shouldn't be. If you want to have your program respond to keys, you need to loop waiting for keyboard input, instead of terminating.

I assumed that you were using QB64 because QB64 uses a separate window for its output instead of the console. Therefore programs that use SYSTEM in QBASIC leave their output in the console window, but programs that use SYSTEM in QB64 just make the output vanish.

Are you in normal SCREEN 0, WIDTH 80, 25? If so, I wouldn't expect your output to vanish, but would expect it to stay on the console, in DOS...

Regards,
Michael

Posted on May 25, 2013, 12:50 PM

Respond to this message   

Return to Index


Can you edit your source code?

by Pete (Login The-Universe)
Admin

If you still have the .bas files, just check to see if the programs end with the statement: SYSTEM

SYSTEM causes the console to close. Replace it with END, and it should stay on the screen, with the message "Press any key to continue..." in the left bottom corner of the console.

Pete

Posted on May 25, 2013, 8:30 AM

Respond to this message   

Return to Index


Adding "Help" Screen to QB 4.5 Programs.

by (no login)

Hi Pete!

Yes, I'm fairly certain that I *do* have the source code on a floppy somewhere around here. In fact my current project is to go through all my BAS files to try to figure out which one I compiled the EXE from.

The trouble is that I have so many different BAS versions of that program, that I can't say for sure which one I compiled it from.

So, my next project is to figure out how to add a pop-up "Help" screen to all my subsequent programs. The help screen would show the version number and date of the BAS file that it was compiled from, along with simple instructions, such as command line syntax for running it.

The EXE file runs flawlessly. What I'm trying to do is run my various BAS files from the command line in an attempt try to figure out which one of them is the most likely suspect as the source for the EXE.

So, I *can* edit these BAS files, and I'm going to try some of the tips you and others have posted.

Will in Seattle
a.k.a. "Clueless"
Running QuickBasic 4.5
Under MS-DOS 6.21

Posted on May 25, 2013, 8:54 AM

Respond to this message   

Return to Index


greetings everyone. long time no see to some of you.

by (Login bomberpunk)
R

i think it's been about four years since i've been on n54. since then i've gotten myself married and there's a bun in the oven (her oven, not mine...*crickets*). we find out in exactly 2 weeks what we're having!

have i stopped coding in qbasic? absolutely not!
have i gotten better? absolutely not!

here's my latest (not the final version, there are 5 known bugs):
Chameleon -http://www.mediafire.com/download/28jmdwd45frt1cw/CHAMELEON_v05232013.EXE
[QB64 version] -http://www.mediafire.com/download/gbfxc511cll17bu/CHAMELEON_QB64.exe

then there's the one i did before that.
TapKey RPG -http://www.mediafire.com/download/2d02m4qq0ceyxzx/TAP_RPG.EXE

and finally, here's a port i did earlier this year of a VIC-20 game
Blitz -http://www.mediafire.com/view/8cm2y6697turo1x/BLITZ.BAS

all three were done in qb 1.1 and are compatible with Vista and earlier. not sure about 7 or 8.

Posted on May 24, 2013, 3:32 PM

Respond to this message   

Return to Index


* High bp, nice to see you back.

by Pete (Login The-Universe)
Admin

Posted on May 24, 2013, 4:47 PM

Respond to this message   

Return to Index


* Welcome back, and congratulations. If it works in Vista, it probably works in 7.

by (Login MCalkins)
Moderator

Posted on May 24, 2013, 8:45 PM

Respond to this message   

Return to Index


*yep, it works in windows 7 as well.

by (Login bomberpunk)
R

Posted on Jun 4, 2013, 6:58 AM

Respond to this message   

Return to Index


Posting Problem

by (Login Clueless_in_Seattle)

I could've sworn I posted a message here yesterday.

But this morning I don't find it in the message index.

Could I be on moderated status?

Will in Seattle
a.k.a. "Clueless"

Posted on May 24, 2013, 9:28 AM

Respond to this message   

Return to Index


Re: Posting Problem

by (Login MCalkins)
Moderator

If you were replying to a post, perhaps it wasn't on the first page?

The only messages that I deliberately deleted yesterday were those <script> messages. If your message was a reply to one of them, it might have been collateral damage.

Perhaps one of the other moderators knows.

Regards,
Michael

Posted on May 24, 2013, 9:54 AM

Respond to this message   

Return to Index


network54 account passwords compromised.

by (Login MCalkins)
Moderator

http://www.network54.com/Forum/44985/thread/1368870975/Password+problems+at+Network54

Use the Reset Password link from that forum post, as the one from the regular forum software doesn't work.

Regards,
Michael

Posted on May 19, 2013, 8:12 PM

Respond to this message   

Return to Index


Network54 was off-line for about an hour Saturday.

by Pete (no login)

Network54 and all message boards were off for about an hour. They had been experiencing a lot of lag for about two days prior to that happening.

Pete

Posted on May 19, 2013, 8:32 PM

Respond to this message   

Return to Index


Welcome to the Cloud

by (Login burger2227)
R

Cloud 9...

It must be hard for N54 to keep the cloud going in their basement.

N54 where are you?

Posted on May 20, 2013, 9:09 AM

Respond to this message   

Return to Index


LOL - Yes, the forecast for last Saturday was...

by Pete (Login The-Universe)
Admin

Partly cloudy, with a chance of ruin.

Pete happy.gif

Posted on May 20, 2013, 1:07 PM

Respond to this message   

Return to Index


Thank you Michael!

by (Login PhyloGenesis)
Moderator

Although, curiously I did not receive an email when I changed my password... I suggest being extra careful.

Posted on May 23, 2013, 12:27 PM

Respond to this message   

Return to Index


It might be time to relocate this forum to a new provider...

by G (no login)

SQL injection is a very well known problem and having a site which is vulnerable to this is a disgrace. Considering managing other people's content is all they do, and that they charge money for it, this should never have been allowed to happen. Network54 are (almost) completely incompetent, as shown by the other problems that have happened to this forum in the past and if I was a betting man I'd lay money on something else going disastrously wrong in the future. To be honest though, I cannot image anything worse than username and password leeks.

<script>alert("At least this doesn't work");</script>
or
&lt;script&gt;alert(&quot;At least this doesn't work&quot;);&lt;/script&gt;

Posted on May 23, 2013, 8:11 PM

Respond to this message   

Return to Index


That was you?

by (Login MCalkins)
Moderator

I just deleted 2 of those posts. I wasn't sure if it was spam, or someone testing for vulnerabilities...

If people follow the standard practice of using different passwords for each site, then a password leak is of limited consequence.

As always, I hope that someone is making complete and reliable backups of the forums.

Regards,
Michael

Posted on May 23, 2013, 8:31 PM

Respond to this message   

Return to Index


*Sorry, that was me testing for vunerabilities. Won't happen again.

by G (no login)

Posted on May 24, 2013, 4:58 PM

Respond to this message   

Return to Index


Re: *Sorry, that was me testing for vunerabilities. Won't happen again.

by (Login MCalkins)
Moderator

I don't object to it, although I did find it curious that you did it in such old topics. You might have made a new topic saying that you were testing, and done it as replies to that. Then, you could say when you're done with it, and the whole thing could be deleted.

If there are vulnerabilities, it's better that they be discovered by a friend, and reported and fixed, rather than being discovered by a foe, and exploited. That's my opinion, and I am not speaking for Pete or Network54.

Regards,
Michael

Posted on May 24, 2013, 8:54 PM

Respond to this message   

Return to Index


Regular polygon drawer

by lawgin (no login)

Works well with 3-20 sides.


SCREEN 12
INPUT "No. of sides:"; n
a = 360 / n
PSET (450, 350 - 3 * n)
FOR a = 0 TO 360 STEP a
DRAW "TA" + STR$(a) + "u" + STR$(INT(1000 / n))
NEXT




Posted on May 19, 2013, 10:05 AM

Respond to this message   

Return to Index


* Doesn't work too well with zero...

by (Login burger2227)
R

Posted on May 19, 2013, 11:05 AM

Respond to this message   

Return to Index


*What does a polygon with 0 sides look like?

by lawgin (no login)

Posted on May 19, 2013, 3:42 PM

Respond to this message   

Return to Index


nothing there

by (Login GarryRicketson)
R

with out any sides , there is nothing there, it is invisable.

Posted on May 19, 2013, 5:50 PM

Respond to this message   

Return to Index


Or maybe it's a point

by lawgin (no login)

It would have zero area and zero perimeter, just like a point.

Posted on May 19, 2013, 6:10 PM

Respond to this message   

Return to Index


1 pixel

by (Login GarryRicketson)
R

There might be one, my eyes are so bad, if there was 1 pixel, or "point", I might not have been able to see it, I tried 1 and got a long line,...

Posted on May 19, 2013, 6:15 PM

Respond to this message   

Return to Index


nice explanation

by Jim (no login)

any insight on this?

http://www.network54.com/Forum/648955/message/1368089844/...

Posted on May 19, 2013, 7:14 PM

Respond to this message   

Return to Index


Infinite perimeter?

by lawgin (no login)

I think it's more accurate to say that the perimeter of the Koch fractal approaches infinity as the number of iterations increase. The perimeter is always finite.

It's analogous to the flea that jumps toward the edge of the table, always halving the distance between itself and the edge. The flea approaches the table's edge, never actually reaching it.

Posted on May 22, 2013, 10:22 AM

Respond to this message   

Return to Index


Spoken like a true mathematician.

by (Login Kewbie)
R

But at the point where the flea jumps so that it's center of gravity is beyond the edge of the table, it will fall off. Which reminds me of a joke:

An engineer and a mathematician are put in a room with a beautiful naked woman at the far side. They are told that each time a bell rings, they can move half the distance to the woman and ultimately have their way with her, as she is ready and willing.

After two rings of the bell, the mathematician gets disgusted and departs, saying that by the given rules, he'll never get to her.

The engineer, however, hangs in there, figuring that after a few more rings, he'll be close enough for all practical purposes.

Kew

Posted on May 23, 2013, 9:56 AM

Respond to this message   

Return to Index


LOL--here's another one

by lawgin (no login)

What is the difference between and engineer, a physicist, and a mathematician?
An engineer believes equations approximate the world.
A physicist believes the world approximates equations.
A mathematician sees no connection between the two.

Posted on May 23, 2013, 3:33 PM

Respond to this message   

Return to Index


'the flea' analogy is example of convergence

by Jim (no login)

the area converges, but the perimeter diverges, & the koch curve approaches infinity. another similar situation is the length of the curve of the area enclosed by 1/x and x=1, x=0, y=0, which diverges, unlike the enclosed area

Posted on May 23, 2013, 12:35 PM

Respond to this message   

Return to Index


Convergence and divergence

by lawgin (no login)

Sometimes it's not obvious:

1/2 + 1/4 + 1/8 + 1/16 +... converges on 1 (the flea example)

1/2 + 1/3 + 1/4 + 1/5 +... diverges to infinity

Posted on May 23, 2013, 3:39 PM

Respond to this message   

Return to Index


the polygon gets raised up the screen with more sides

by Jake (no login)

Posted on May 19, 2013, 4:01 PM

Respond to this message   

Return to Index


haven't been here in years...

by (Login judasghost)

it's been years since i've been to this old N54 forum, since the Mac era. who runs this place now? and how can i access my old login?

cheers,
bp

Posted on May 19, 2013, 6:31 AM

Respond to this message   

Return to Index


Pete

by (Login GarryRicketson)
R

I guess Pete is "in charge", you should be able to access you old login ,using your old loggin name, and password, if you can not remember it, I think you can still get it,..
from Garry
Note:
You log in athttp://www.network54.com
If you do not have a account , you would need to start a new one,..
However
I was just checking, this is what I got "
Login attempt failed. Try again. All login passwords were reset on 18 May 2013. You may need to reset your password. One more try before account is locked."

and it appears as of May 18, 2013,..net54 has reset evryones passwords,.. I have to change mine , now too,..
Also, I select "all ways stay logged in" in my profile, so I don't have to log in every time,..but that is optional.

http://www.network54.com/Forum/44985/thread/1368870975/Password+problems+at+Network54

Posted on May 19, 2013, 5:53 PM

Respond to this message   

Return to Index


*thanks for your help! now i'm REALLY back

by (Login bomberpunk)
R

Posted on May 24, 2013, 3:23 PM

Respond to this message   

Return to Index


qb64.net

by (Login dvdbrgdn)

anyone know why qb64.net is taking so long to approve my account? It making me sad :(

Posted on May 18, 2013, 4:24 PM

Respond to this message   

Return to Index


*You need to send an Email to Galleon

by G (no login)

Posted on May 18, 2013, 5:39 PM

Respond to this message   

Return to Index


* Have you gotten your account yet?

by (Login MCalkins)
Moderator

Posted on May 23, 2013, 8:34 PM

Respond to this message   

Return to Index

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement