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



Anybody know some simple tunes

by (no login)

Anybody know of a site with some short tunes that can be played in qbasic? I would like to add some simple sounds to my text adventure and while I understand how to use the play command I don't know anything about making music. Just mainly looking for something simple for example a short tune similar to what you hear in the original pitfall when you pick up a treasure. Have tried googling qbasic music, qbasic sheet music, etc and all I found was the happy birthday theme. I have created some neat stuff with for x loops but unfortunately you can't main buffer that stuff and execute other commands while they play.

If there are no sites anybody have some interesting tunes to share? Just would like some simple stuff.

Posted on Jul 18, 2012, 9:39 AM

Respond to this message   

Return to Index


Re: Anybody know some simple tunes

by (no login)

QB64 allows you to load actual Sound files - so you can do that instead of using SOUND and PLAY. You can just load your favorite mp3 and use that as the background music.

Check out the QB64 wiki for syntax details

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

Posted on Jul 18, 2012, 11:20 AM

Respond to this message   

Return to Index


Re: Anybody know some simple tunes

by (Login MCalkins)
Moderator

You know how to transpose sheet music to PLAY statements, right? (In other words, can you read sheet music?)

There should be plenty of public domain classical music and folk tunes on the internet. I'd look for older stuff with expired copyright. (Everything published prior to 1923 is public domain.)

You can use PLAY "MB", to play in the background. You can use ON PLAY event trapping to continue to feed the buffer.

QB64 extends the PLAY statement by letting you play multiple notes at once, bit it doesn't (as far as I know) support ON PLAY event trapping. QB64 will also let you play MIDI files.

Regards,
Michael

Posted on Jul 18, 2012, 11:29 AM

Respond to this message   

Return to Index


MAYBE? ...

by OPRESION (no login)

http://qbasicnews.com/abc/showpacket.php?packet=SOUND.ABC

Posted on Jul 18, 2012, 9:09 PM

Respond to this message   

Return to Index


qb4.5 to qb64

by (no login)

I have a rather small (100line) program that works fine in qb4.5
How do I copy this to qb64.
When I just copy source program into qb64 it is not readable.

However, if I just re-code the 100 lines exactly as in qb4.5 it compiles and runs exactly as qb4.5.

How am I suppose to copy a qb4.5 source to qb64. Do I convert to text first. Thanks

Posted on Jul 18, 2012, 8:53 AM

Respond to this message   

Return to Index


Re: qb4.5 to qb64

by (Login MCalkins)
Moderator

When you are in QB 4.5, go to "File", "Save As...", and make sure that you select "Text - Readable by Other Programs".

Regards,
Michael

Posted on Jul 18, 2012, 9:31 AM

Respond to this message   

Return to Index


Re: qb4.5 to qb64

by richard (no login)

ok. this worked fine thanks very much
I assumed there was a simple solution, but your help was quick and saved me lots of time.

Posted on Jul 18, 2012, 10:50 AM

Respond to this message   

Return to Index


*yw

by (Login MCalkins)
Moderator

Posted on Jul 18, 2012, 11:18 AM

Respond to this message   

Return to Index


Antialiasing in QB64

by (no login)

I made an antialiasing program - it scans the screen for pixels which need to be antialiased(edge pixels) and then blurs them accordingly. The problem is, it doesn't do anything. This is my source code :

SUB antialias (screenx, screeny)
FOR dx = 1 TO screenx - 1
FOR dy = 1 TO screeny - 1
op = POINT(dx, dy)
ra = 0
ba = 0
ga = 0
FOR cx = -1 TO 1
FOR cy = -1 TO 1
cp = POINT(dx + cx, dy + cy)
comparison = ABS(_RED32(op) - _RED32(cp)) + ABS(_BLUE32(op) - _BLUE32(cp)) + ABS(_GREEN32(cp) - _GREEN32(op))
IF comparison > 100 THEN
difpix = difpix + 1
END IF
ra = ra + (_RED32(cp) / 9)
ba = ba + (_BLUE32(cp) / 9)
ga = ga + (_GREEN32(cp) / 9)
NEXT cy
NEXT cx
IF difpix >= 1 AND difpix <= 4 THEN
difpix = 0
PSET (dx, dy), _RGB(ra, ga, ba)
END IF
NEXT dy
NEXT dx
END SUB

Posted on Jul 17, 2012, 7:52 AM

Respond to this message   

Return to Index


Update

by (no login)

This is what I have now :

SUB antialias (screenx, screeny)
FOR dx = 1 TO screenx - 1
FOR dy = 1 TO screeny - 1
ra = 0
ba = 0
ga = 0
op~&& = POINT(dx, dy)
FOR cx = -1 TO 1
FOR cy = -1 TO 1
cp~&& = POINT(dx + cx, dy + cy)
comparison = ABS(_RED32(op~&&) - _RED32(cp~&&)) + ABS(_BLUE32(op~&&) - _BLUE32(cp~&&)) + ABS(_GREEN32(cp~&&) - _GREEN32(op~&&))
IF comparison > 100 THEN
difpix = difpix + 1
END IF
averagecolor~&& = averagecolor~&& + (cp~&& / 9)
NEXT cy
NEXT cx
IF difpix >= 1 AND difpix <= 4 THEN
difpix = 0
PSET (dx, dy), average~&&
END IF
NEXT dy
NEXT dx
END SUB

Posted on Jul 17, 2012, 10:45 AM

Respond to this message   

Return to Index


Another Update

by (no login)

I revised my anti aliasing program (again), but the colors are completely wrong. I checking the averaging algorithm and it seems fine...but the program just doesn't work...I have no idea what the issue is..

Source code (I added comments) :


SCREEN _NEWIMAGE(1280, 720, 32)

' Draws some shapes to test the subroutine
'LINE (0, 0)-(720, 720), _RGB(255, 0, 0)
CIRCLE (500, 500), 100, _RGB(255, 255, 255)
PAINT (500, 500), _RGB(255, 255, 255), _RGB(255, 255, 255)

'call the sub after drawing the shapes.
CALL antialias(1280, 720)


SUB antialias (screenx, screeny)
FOR dx = 1 TO screenx - 1 'goes through each pixel for the entire area of the screen
FOR dy = 1 TO screeny - 1
averagecolor~&& = 0 'reset average color and other values
difpix = 0
op~&& = POINT(dx, dy) ' get the color of the main pixel
FOR cx = -1 TO 1 'gets the 8 pixels around (dx,dy)
FOR cy = -1 TO 1
cp~&& = POINT(dx + cx, dy + cy) 'get the color of each of the 8 pixels

IF (cp~&& > op~&& AND (cp~&& / op~&&) > 1.000459770087633) OR (op~&& > cp~&& AND (op~&& / cp~&& > 1.000459770087633)) THEN difpix = difpix + 1
'check if the colors of the pixels are different enough to antialias them

averagecolor~&& = averagecolor~&& + (cp~&& / 9)
'find the average color of (dx,dy) and the 8 pixels surrounding it regardless of whether the pixel needs antialiasing

NEXT cy
NEXT cx
IF difpix >= 1 AND difpix < 5 THEN 'if there are different colored pixels among the 8
'(but not too many otherwise it would antialias a 1-pixel line causing it to lose color. EG. any point on a vertical 1-pixel line has 6 different colored pixels around it)
' antialiasing this sort of line would only cause it to lose color

PSET (dx, dy), averagecolor~&&

'PRINT , dx, dy, _RED32(averagecolor~&&), _GREEN32(averagecolor~&&), _BLUE32(averagecolor~&&)
'SLEEP
'For debugging - goes through each pixel which needs to be antialiased and gives its
' coordinates and RGB values.
END IF
NEXT dy
NEXT dx
END SUB

Posted on Jul 18, 2012, 8:26 AM

Respond to this message   

Return to Index


One thing you might try...

by (Login qb432l)
R

In this example, the antialiasing color should be R:128,G:128,B:128 -- in other words, a medium gray, since the foreground is white and the background is black. Do some simple experiments with just that part of your code that determines the average color.

Try it out with different foreground/background colors where you know in advance what the answer should be, for example, if you had used the red background, the antialiasing color should have been R:192,G:128,B:128.

That's the way I'd proceed, anyway.

-Bob

Posted on Jul 19, 2012, 5:04 AM

Respond to this message   

Return to Index


This is what I have so far

by (no login)

The averaging part is fine but it doesn't look good because of some of the checks i've put in (specifically the one i've marked)


SCREEN _NEWIMAGE(1280, 720, 32)
LOCATE 25, 20
PRINT "This is aliased"
' Draws some shapes to test the subroutine
LINE (0, 0)-(720, 720), _RGB(255, 0, 0)
CIRCLE (500, 500), 100, _RGB(255, 255, 255)
PAINT (500, 500), _RGB(255, 255, 255), _RGB(255, 255, 255)
_DELAY 2
'call the sub after drawing the shapes.
CALL antialias(1280, 720)
LOCATE 25, 20
PRINT "This is antialiased"


SUB antialias (screenx, screeny)
FOR dx = 1 TO screenx - 1 'goes through each pixel for the entire area of the screen
FOR dy = 1 TO screeny - 1
ra = 0
ga = 0
ba = 0 'reset color and other values
difpix = 0
weightednum = 0
op~&& = POINT(dx, dy) ' get the color of the main pixel
FOR cx = -1 TO 1 'gets the 8 pixels around (dx,dy)
FOR cy = -1 TO 1
cp~&& = POINT(dx + cx, dy + cy) 'get the color of each of the 8 pixels
IF (cp~&& > op~&& AND (cp~&& / op~&&) > 1.001226993792092) OR (op~&& > cp~&& AND (op~&& / cp~&& > 1.001226993792092)) THEN
difpix = difpix + 1
ra = ra + (_RED32(cp~&&))
ga = ga + (_GREEN32(cp~&&))
ba = ba + (_BLUE32(cp~&&))
weightednum = weightednum + 1
END IF
'check if the colors of the pixels are different enough to antialias them
weightednum = weightednum + 1
ra = ra + (_RED32(cp~&&))
ga = ga + (_GREEN32(cp~&&))
ba = ba + (_BLUE32(cp~&&))
'find the average color of (dx,dy) and the 8 pixels surrounding it regardless of whether the pixel needs antialiasing

NEXT cy
NEXT cx
' The Difpix part is ruining the effect but it's necessary because otherwise the subroutine would blur lines unnecessarily
IF difpix >= 1 AND difpix < 6 THEN 'if there are different colored pixels among the 8
'(but not too many otherwise it would antialias a 1-pixel line causing it to lose color. EG. any point on a vertical 1-pixel line has 6 different colored pixels around it)
' antialiasing this sort of line would only cause it to lose color

PSET (dx, dy), _RGB((ra / weightednum), (ga / weightednum), (ba / weightednum))

'PRINT , dx, dy, _RED32(averagecolor~&&), _GREEN32(averagecolor~&&), _BLUE32(averagecolor~&&)
'SLEEP
'For debugging - goes through each pixel which needs to be antialiased and gives its
' coordinates and RGB values.
END IF
NEXT dy
NEXT dx
END SUB

Thanks for your help

Posted on Jul 19, 2012, 6:04 AM

Respond to this message   

Return to Index


*Hey, not bad -- and the red line works well, too! :-)

by (Login qb432l)
R

*

Posted on Jul 19, 2012, 7:34 PM

Respond to this message   

Return to Index


I made it even better

by (no login)

In my previous program, straight lines would be blurred as well(and straight edges + corners of objects). It would blur the entire boundary of a rectangle and the circle didn't look so good.So I modified it to ignore 1-pixel lines(because from far away it didn't seem to make a difference) and straight edges completely and this is what I ended up with :


SCREEN _NEWIMAGE(1280, 720, 32)
LOCATE 5, 20
PRINT "This is aliased"
' Draws some shapes to test the subroutine
LINE (0, 0)-(720, 720), _RGB(255, 0, 0)
LINE (110, 110)-(720, 720), _RGB(255, 0, 0), BF
CIRCLE (500, 500), 100, _RGB(255, 255, 255)
PAINT (500, 500), _RGB(255, 255, 255), _RGB(255, 255, 255)
SLEEP
'call the sub after drawing the shapes.
s# = TIMER(.001)
CALL antialias(1280, 720, 1)
tiaa = TIMER(.001) - s#
PRINT
LOCATE 5, 20
PRINT "This is antialiased. It took "; tiaa; " seconds to antialias the image"
SLEEP
CLS
LINE (0, 0)-(720, 720), _RGB(255, 0, 0)
LINE (110, 110)-(720, 720), _RGB(255, 0, 0), BF
CIRCLE (500, 500), 100, _RGB(255, 255, 255)
PAINT (500, 500), _RGB(255, 255, 255), _RGB(255, 255, 255)
df# = TIMER(.001)
CALL blur(1280, 720)
tiblur = TIMER(.001) - df#
LOCATE 5, 20
PRINT "This is blurred. It took "; tiblur; " seconds to blur the image"
SLEEP
CLS
PRINT "Antialiasing was "; (tiblur / tiaa) * 100 - 100; "% faster."

SUB antialias (screenx, screeny, quality)
FOR main = 1 TO quality
ws& = _NEWIMAGE(screenx + 1, screeny + 1, 32)
_PUTIMAGE (0, 0)-(screenx, screeny), , ws&, (0, 0)-(screenx, screeny)
_SOURCE ws&
FOR dx = 1 TO screenx - 1 'goes through each pixel for the entire area of the screen
FOR dy = 1 TO screeny - 1
ra = 0
ga = 0
ba = 0 'reset color and other values
difpix = 0
weightednum = 0
op~&& = POINT(dx, dy) ' get the color of the main pixel
FOR cx = -1 TO 1 'gets the 8 pixels around (dx,dy)
FOR cy = -1 TO 1
cp~&& = POINT(dx + cx, dy + cy) 'get the color of each of the 8 pixels
comparison = ABS(_RED32(op~&&) - _RED32(cp~&&)) + ABS(_BLUE32(op~&&) - _BLUE32(cp~&&)) + ABS(_GREEN32(cp~&&) - _GREEN32(op~&&))
IF comparison > 175 THEN
difpix = difpix + 1
END IF
'check if the colors of the pixels are different enough to antialias them
weightednum = weightednum + 1
ra = ra + (_RED32(cp~&&))
ga = ga + (_GREEN32(cp~&&))
ba = ba + (_BLUE32(cp~&&))
'find the average color of (dx,dy) and the 8 pixels surrounding it regardless of whether the pixel needs antialiasing

NEXT cy
NEXT cx
IF difpix > 3 AND difpix < 5 THEN 'if there are different colored pixels among the 8
'(but not too many otherwise it would antialias a 1-pixel line causing it to lose color. EG. any point on a vertical 1-pixel line has 6 different colored pixels around it)
' antialiasing this sort of line would only cause it to lose color

PSET (dx, dy), _RGB((ra / weightednum), (ga / weightednum), (ba / weightednum))

'PRINT , dx, dy, _RED32(averagecolor~&&), _GREEN32(averagecolor~&&), _BLUE32(averagecolor~&&)
'SLEEP
'For debugging - goes through each pixel which needs to be antialiased and gives its
' coordinates and RGB values.
END IF
NEXT dy
NEXT dx
_FREEIMAGE ws&
NEXT main
END SUB

SUB blur (x, y)
ws& = _NEWIMAGE(x + 1, y + 1, 32)
_PUTIMAGE (0, 0)-(x, y), , ws&, (0, 0)-(x, y)
_SOURCE ws&
DIM p~&(9)
FOR cx = 1 TO x - 1 STEP 1
FOR cy = 1 TO y - 1 STEP 1
index = 0
FOR dx = -1 TO 1
FOR dy = -1 TO 1
index = index + 1
p~&(index) = POINT(cx + dx, cy + dy)
NEXT dy
NEXT dx
redaverage~& = 0
blueaverage~& = 0
greenaverage~& = 0
FOR dd = 1 TO 9
redaverage~& = (_RED32(p~&(dd)) / 9) + redaverage~&
NEXT dd
FOR dd = 1 TO 9
greenaverage~& = (_GREEN32(p~&(dd)) / 9) + greenaverage~&
NEXT dd
FOR dd = 1 TO 9
blueaverage~& = (_BLUE32(p~&(dd)) / 9) + blueaverage~&
NEXT dd
PSET (cx, cy), _RGB(redaverage~&, greenaverage~&, blueaverage~&)
NEXT cy
NEXT cx
_FREEIMAGE (ws&)
END SUB

Posted on Jul 20, 2012, 6:14 AM

Respond to this message   

Return to Index


*Yeah -- definitely a speed improvement. Nice going.

by (Login qb432l)
R

*

Posted on Jul 20, 2012, 7:49 AM

Respond to this message   

Return to Index


failure to go to subroutine

by Leon Schrecengost (no login)

I have a subroutine that will send data from an array to the printer. I use the lprint command. My problem is when I call the routine nothing happens. When I exit the program it sends the data to the printer. If I change the first line from lprint to print it will display it on the screen what I write but does not contingue to exicute the rest of the routine. Any ideas.
Leon

Posted on Jul 16, 2012, 1:12 PM

Respond to this message   

Return to Index


hm...

by (no login)

Not a clue, sorry.

You should try to print something at some place in the man program as test.

Posted on Jul 16, 2012, 2:01 PM

Respond to this message   

Return to Index


Re: failure to go to subroutine

by (Login MCalkins)
Moderator

Are you using QBASIC or QB64?
What Windows version?
How is your printer connected?
What happens when you:

LPRINT CHR$(&HC);

Does that make it print the page?

Regards,
Michael

Posted on Jul 16, 2012, 2:18 PM

Respond to this message   

Return to Index


failure to go to sub routine

by Leon Schrecengost (no login)

I am using Qbasic. Yes I can print to the printer. If I run the subroutine as a stand alone pgm. it works fine. I can send printer commands such as Chr$(10) to insert spaces between lines and the ,,moves the cursor 28 spaces.

So does any of this make any sense?
Leon

Posted on Jul 16, 2012, 4:23 PM

Respond to this message   

Return to Index


Re: failure to go to sub routine

by (Login MCalkins)
Moderator

Yeah, but it's been many years since I've done anything with a printer from QBASIC. At the moment, I only have two suggestions:

Try LPRINTing something, then LPRINT CHR$(12); which is the form feed character. See if that causes it to spit out a page.

Perhaps, try OPENing "LPT1" FOR OUTPUT, and PRINT #1, etc. You might also send CHR$(12), then CLOSE the device, and see if that causes it to print...

Note: these are just ideas. I really don't know if they will work.

You're trying to print whole pages at once, right, not just a few lines at a time?

Regards,
Michael

Posted on Jul 17, 2012, 12:24 AM

Respond to this message   

Return to Index


failure to go to sub routine

by Leon Schrecengost (no login)

What I don't understand is why It will not go to the subroutine and why when I end the program it prints. The following is a short sample of the pgm.


10 cls
20 DIM Z$(10,3)
30 let I$ = inkey$
40 Print "press v to view array data"
50 Print "press p to print array data"
60 Press "press e to exit pgm"
70 P1$ = Z$(0,0):P2$ = Z$(0,1):P3$ = Z$(0,2)
80 If I$ = "e" then end
90 IF I$ = "v" then gosub 700 This displays data in the array {works fine)
100 If I$ = "p" then gosub 3000
110 goto 30

This is a very abrevated version of the pgm

Subroutine for lprint

3000 LPRINT CHR$(10) : LPRINT P1$,,P2$,,P3$
3010 RETURN

Posted on Jul 17, 2012, 5:06 AM

Respond to this message   

Return to Index


It is going to the subroutine

by (Login MCalkins)
Moderator

That's not the problem. As you discovered when you changed the LPRINT to PRINT, it is going to the subroutine.

I think it's most likely that the printing output is being queued. That is why it prints when the program ends. Perhaps, it's waiting until it has a full page to start printing? Hence, my CHR$(12) suggestion.

Entirely separate from the printer problems, I would suggest using a cleaner coding style.

Regards,
Michael

-----

DIM z(0 TO 10, 0 TO 3) AS STRING
DIM i AS STRING, p1 AS STRING, p2 AS STRING, p3 AS STRING

CLS
DO
 i = INKEY$
 PRINT "press v to view array data"
 PRINT "press p to print array data"
 PRINT "press e to exit pgm"
 p1 = z(0, 0): p2 = z(0, 1): p3 = z(0, 2)
 SELECT CASE i
  CASE "e": END
  CASE "v": GOSUB ViewArray
  CASE "p": GOSUB PrintArray
 END SELECT
LOOP

ViewArray:
RETURN

PrintArray:
LPRINT CHR$(10): LPRINT p1$, , p2$, , p3$
RETURN

Posted on Jul 17, 2012, 6:51 AM

Respond to this message   

Return to Index


not going to subroutine

by Leon Schrecengost (no login)

I put the LPRINT CHR$(12)in and now it will print and expell the page.
It still will not print unless I exit the pgm. I have the printer status box open and it's not being sent to the printer until the end cmd. I think you're on the right track. If I end the pgm with out calling the print routine it just exits.I'm completly baffled.

Posted on Jul 17, 2012, 10:13 AM

Respond to this message   

Return to Index


try something like this

by (Login MCalkins)
Moderator

I'm not in a good position to test it, as I don't have an LPT printer hooked up...
Regards,
Michael

DIM i AS INTEGER
OPEN "LPT1" FOR OUTPUT AS 1
FOR i = 0 TO 15: PRINT #1 "Hello": NEXT
PRINT #1, CHR$(12);
CLOSE

PRINT "Did that print yet?"
SLEEP: WHILE LEN(INKEY$): WEND

OPEN "LPT1" FOR OUTPUT AS 1
FOR i = 0 TO 15: PRINT #1 "Goodbye": NEXT
PRINT #1, CHR$(12);
CLOSE
SYSTEM

Posted on Jul 17, 2012, 12:15 PM

Respond to this message   

Return to Index


try this

by Leon Schrecengost (no login)

Michael, I get an error message line 3

FOR i=0 TO 15:PRINT #1 "HELLO":NEXT

The error message is (EXPECTED) : and highlites the "H

I'm using DOS print to redirect the LPT1 port to my hp 4400 USB printer
works for everything except the sub routine call.

Posted on Jul 17, 2012, 12:58 PM

Respond to this message   

Return to Index


I forgot the commas

by (Login MCalkins)
Moderator

DIM i AS INTEGER
OPEN "LPT1" FOR OUTPUT AS 1
FOR i = 0 TO 15: PRINT #1, "Hello": NEXT
PRINT #1, CHR$(12);
CLOSE

PRINT "Did that print yet?"
SLEEP: WHILE LEN(INKEY$): WEND

OPEN "LPT1" FOR OUTPUT AS 1
FOR i = 0 TO 15: PRINT #1, "Goodbye": NEXT
PRINT #1, CHR$(12);
CLOSE
SYSTEM

Posted on Jul 17, 2012, 1:23 PM

Respond to this message   

Return to Index


commas

by Leon Schrecengost (no login)

That worked fine. I still have the issue of not going to the sub routine. I'm going to try your program imbedded in mine as a sub routine and see if it will work. will keep you posted.

Posted on Jul 17, 2012, 4:40 PM

Respond to this message   

Return to Index


commas

by Leon Schrecengost (no login)

Michael, That was it it runs ok. I used your pgm as a sub routine in my pgm. I even added the same line numbers and it worked. I totaly don't understand why it will work and not mine.(Maybe your just good) Any way can I subtitute my array name z$ and the location in that pgm and print the array data. I will remove the loop funtion and add CHR$(10) to get the line space between array address. I would have something that would look like this in place of "HELLO" z$(0,1). I would not use the quotation marks.

Posted on Jul 18, 2012, 5:34 AM

Respond to this message   

Return to Index


Good. Now that your initial problem is resolved ....

by Solitaire (Login Solitaire1)
S

Please get rid of those obsolete numbered lines and learn to use stuctured loops! That outdated practice goes back to GWBASIC, which is even older than QBasic.

I was going to suggest using a menu in a DO loop but Michael beat me to it. I strongly suggest using the code he posted above (repeated below), and move your program over to a structured version:

DIM z(0 TO 10, 0 TO 3) AS STRING
DIM i AS STRING, p1 AS STRING, p2 AS STRING, p3 AS STRING

CLS
DO
 i = INKEY$
 PRINT "press v to view array data"
 PRINT "press p to print array data"
 PRINT "press e to exit pgm"
 p1 = z(0, 0): p2 = z(0, 1): p3 = z(0, 2)
 SELECT CASE i
  CASE "e": END
  CASE "v": GOSUB ViewArray
  CASE "p": GOSUB PrintArray
 END SELECT
LOOP

ViewArray:
RETURN

PrintArray:
LPRINT CHR$(10): LPRINT p1$, , p2$, , p3$
RETURN

Posted on Jul 18, 2012, 7:12 AM

Respond to this message   

Return to Index


yeah

by (Login MCalkins)
Moderator

I think the difference is opening and closing the device. I'm guessing that doing that tells NTVDM to go ahead and print. Even without the CHR$(12) I've got my doubts whether you'll be able to print just lines at a time. You might get forced into printing whole pages at once.

The "Hello" bit was just an test/example. You should be able to substitute your own strings.

Regards,
Michael

Posted on Jul 18, 2012, 8:12 AM

Respond to this message   

Return to Index


yeah

by Leon Schrecengost (no login)

Thanks to everyone who helped. I made the subtitions for hello and it works fine. Just have to work out the page layout.
Leon

Posted on Jul 18, 2012, 8:39 AM

Respond to this message   

Return to Index


print formatting

by LeonSchrecengost (no login)

Now that I,m able to print i'm trying to format the data. The only issue is getting the print back to the left margin. I tried chr$(13) which should be CR I thought after that I would be able to tab to the position I wanted to start the next print string. Does not work for me.

Posted on Jul 19, 2012, 8:41 AM

Respond to this message   

Return to Index


Try CHR$(10) Line feed or CHR$(13) + CHR$(10)

by (Login burger2227)
R

CRLF$ = CHR$(13) + CHR$(10)

add it to the end of the string or

LPRINT CRLF$


CHR$(12) is form feed to eject paper.

Posted on Jul 19, 2012, 2:44 PM

Respond to this message   

Return to Index


Line feed

by Leon Schrecengost (no login)

CRLF$ works thanks

Posted on Jul 20, 2012, 7:27 AM

Respond to this message   

Return to Index


QB64.exe Does Not Recognize One DLL File

by (no login)

I am running MS Windows7 with Pro Pkg, 8Gb ram and Intel i3 processor. Every time I download and unzip QB64 and try to start QB64.exe, I get an error message stating that: "Program cannot start because file SDL_image.dll is missing from your computer" when in fact it is listed three files down the listing so it is most definitely there. What is the problem that it is not being recognized? I am in dire need of QB and this is maddening. Thanks!

Posted on Jul 14, 2012, 9:18 PM

Respond to this message   

Return to Index


one thing to try:

by (Login MCalkins)
Moderator

try creating an empty file with this exact name:

qb64.exe.local

in the qb64 folder. See if that lets you start QB64. If that works, you would probably need to create a .local file also for the various executables that you produce.

What folder do you have QB64 installed in? Do you have full permission for that folder?

Are any other programs on your computer using "SDL_image.dll"?

Regards,
Michael

Posted on Jul 14, 2012, 9:51 PM

Respond to this message   

Return to Index


a few more possible experiments

by (Login MCalkins)
Moderator

First of all, please download sha1sum.exe:
ftp://ftp.gnupg.org/gcrypt/binary/sha1sum.exe

and then, from the command line in your QB64 folder, run:

sha1sum sdl_image.dll

it should say:

cf6d995c8caa0e6b8545c4df4b0cd4b0ff2409fe  sdl_image.dll

If not, then your sdl_image.dll is corrupt.

Otherwise, proceed to the next experiment...

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

#include <windows.h>
#include <stdio.h>

HMODULE hm;
CHAR fn[MAX_PATH + 1] = {};

int main(void) {
 hm = LoadLibraryW(L"sdl_mixer.dll");
 if (! hm) {
  printf("LoadLibraryW() failed. Error: 0x%x\n", GetLastError());
  return 0;
 }
 if (! GetModuleFileNameA(hm, fn, MAX_PATH)) {
  printf("GetModuleFileNameA() failed. Error: 0x%x\n", GetLastError());
 }
 printf(fn);
 printf("\n");
 return 0;
}

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

save that (between the hypen lines) as "delme.cpp" in your qb64 folder, and then from the command prompt, from your QB64 folder, run:

internal\c\bin\g++ -s delme.cpp -o delme.exe

which will create "delme.exe". Then, still from the command line, run:

delme.exe

from your qb64 folder. It will try to load "sdl_mixer.dll". If it fails, it will give you an error code. If it succeeds, it should give you the full path of the file that it loaded.

If it can't find "sdl_mixer.dll", it will fail with error 0x7e, which is "ERROR_MOD_NOT_FOUND".

Regards,
Michael



    
This message has been edited by MCalkins on Jul 15, 2012 12:53 AM
This message has been edited by MCalkins on Jul 15, 2012 12:49 AM
This message has been edited by MCalkins on Jul 15, 2012 12:48 AM

Posted on Jul 15, 2012, 12:48 AM

Respond to this message   

Return to Index


have you had any success?

by (Login MCalkins)
Moderator

At least one person on the other forums ( http://www.qb64.net/forum/ ) has reported a similar problem, which seemed to be related to Adobe Reader in some way. However, I was and am skeptical about whether Adobe Reader is related.

Regards,
Michael

Posted on Jul 17, 2012, 12:26 AM

Respond to this message   

Return to Index


Antialiasing in QB64

by (no login)

How would I implement anti-aliasing in QB64?

Posted on Jul 12, 2012, 11:03 AM

Respond to this message   

Return to Index


Update

by (no login)

I made a blurring subroutine but it blurs the entire image instead of just edges. How would I get it to blur only the edges of objects? I posted my source code below.


'This is very,very,very inefficient. On quality 8 it takes at least 10 seconds PER FRAME.
x = 1280
y = 720
INPUT "Set quality level (1-8)"; qual
SCREEN _NEWIMAGE(x, y, 32)
FOR sd = 1 TO qual' blurred image on the left. non-blurred on the right
LINE (640, 0)-(640, 720)
CIRCLE (100, 100), 50, _RGB(255, 0, 0)
PAINT (100, 100), _RGB(255, 0, 0), _RGB(255, 0, 0)
CIRCLE (1180, 100), 50, _RGB(255, 0, 0)
PAINT (1180, 100), _RGB(255, 0, 0), _RGB(255, 0, 0)
CALL blur(x / 2, y)
NEXT sd


SUB blur (x, y)
FOR cx = 1 TO x - 1 STEP 1
FOR cy = 1 TO y - 1 STEP 1
redaverage = _RED32(POINT(cx, cy)) + _RED32(POINT(cx + 1, cy + 1)) + _RED32(POINT(cx + 1, cy)) + _RED32(POINT(cx + 1, cy - 1)) + _RED32(POINT(cx, cy - 1)) + _RED32(POINT(cx, cy + 1)) + _RED32(POINT(cx - 1, cy)) + _RED32(POINT(cx - 1, cy + 1)) + _RED32(POINT(cx - 1, cy - 1))
redaverage = redaverage / 9
greenaverage = _GREEN32(POINT(cx, cy)) + _GREEN32(POINT(cx + 1, cy + 1)) + _GREEN32(POINT(cx + 1, cy)) + _GREEN32(POINT(cx + 1, cy - 1)) + _GREEN32(POINT(cx, cy - 1)) + _GREEN32(POINT(cx, cy + 1)) + _GREEN32(POINT(cx - 1, cy)) + _GREEN32(POINT(cx - 1, cy + 1)) + _GREEN32(POINT(cx - 1, cy - 1))
greenaverage = greenaverage / 9
blueaverage = _BLUE32(POINT(cx, cy)) + _BLUE32(POINT(cx + 1, cy + 1)) + _BLUE32(POINT(cx + 1, cy)) + _BLUE32(POINT(cx + 1, cy - 1)) + _BLUE32(POINT(cx, cy - 1)) + _BLUE32(POINT(cx, cy + 1)) + _BLUE32(POINT(cx - 1, cy)) + _BLUE32(POINT(cx - 1, cy + 1)) + _BLUE32(POINT(cx - 1, cy - 1))
blueaverage = blueaverage / 9
PSET (cx, cy), _RGB(redaverage, greenaverage, blueaverage)
NEXT cy
NEXT cx
END SUB

Posted on Jul 14, 2012, 9:49 AM

Respond to this message   

Return to Index


Do a search for certain conditions, first...

by (Login qb432l)
R

Edge pixels have a background pixel adjacent to them, so you should be able to establish that with a simple scan test. Also, I wouldn't go to the same depth as you do with the antialiasing. The overall effect is not antialiasing, but "rounding" of the edge. Just concentrate on individual adjacent background pixels and make them half-and-half foreground/background in hue.

-Bob



    
This message has been edited by qb432l on Jul 14, 2012 9:02 PM

Posted on Jul 14, 2012, 9:01 PM

Respond to this message   

Return to Index


Re: Do a search for certain conditions, first...

by (no login)

How do I check if it's a background pixel or foreground pixel though?

Posted on Jul 15, 2012, 6:52 AM

Respond to this message   

Return to Index


Just test for either attribute number, or RGB differences...

by (Login qb432l)
R

If Pixel A is significantly different in RGB value from Pixel B, then you have an edge. It doesn't really matter which is "foreground" and which is "background", only that the edge be rendered in a neutral shade.

I'm not sure how this code will be applied, however. If it's meant to be applied to many images, rather than a specific image you're familiar with, then it becomes tricky. Also, it depends on whether the colors are relatively uniform, or varied as in a bitmap. All of my antialasing experience has been "hands on". I've never written code to accomplish it automatically.

-Bob

Posted on Jul 15, 2012, 10:35 AM

Respond to this message   

Return to Index


Re: Just test for either attribute number, or RGB differences...

by (no login)

So would I have to compare the RGB value of a pixel with the 8 pixels surrounding it? If so, is there an efficient way to do that? (Preferably one that does not involve writing a separate statement for each coordinate). Also, after the scan, I want to blur area where the background meets the object/image rather than the image itself. (I tried using my blurring algorithm on a diagonal line and the line became gray, so I want to blur the area where the background meets the line rather than the line itself).

What I'm thinking right now is to keep an array for the coordinates of the pixels which need blurring. (The pixels will be found after the scan) and blur those using my blur subroutine. The problem is I don't know how to find the border of the image (excluding any part of the image itself).

Posted on Jul 15, 2012, 11:08 AM

Respond to this message   

Return to Index


The array might be the way to go...

by (Login qb432l)
R

Unfortunately, you will have to test all adjacent pixels, but I wouldn't bother with diagonals - they wouldn't be a major contributor to aliasing.

I really wish I could help you more, but all of my experience involved working with a limited number of attributes (SCREEN 12) where you already know the hue of each attribute and create antialiasing values in advance.

To be honest, I'm amazed at the efficiency of certain code in professional Photo/Paint apps. Converting bit depth, resizing images -- it all seems so instantaneous. I, on the other hand, am a self-taught programmer, so most of my code is pretty obvious and time-consuming.

Sorry I can't be of more help,
-Bob

Posted on Jul 15, 2012, 9:43 PM

Respond to this message   

Return to Index


Can QB64 use the gpu?

by (no login)

I think the reason that professional paint apps are so fast is that they can take advantage of the gpu. Is there any way to allow QB64 to use the GPU? On my computer, QB64 seems to use just one cpu core and I think this might be the reason for the slow graphical effects.

nVidia uses an antialiasing algorithm call FXAA. It consumes no additional memory and it is supposed to be 60% faster than other antialiasing methods.. Do you know which algorithm they use?

Also, How should I compare the pixel to its adjacent pixels? Right now I am comparing the red, green, and blue values of a pixel to the red, green and blue values of each of its adjacent pixels. So i end up having three statements to compare 2 pixels with each other. Is there a better way to do this? Can I use the value provided by the POINT function directly instead of extracting the RGB values from it?

Posted on Jul 16, 2012, 8:07 AM

Respond to this message   

Return to Index


Re: Can QB64 use the gpu?

by (Login MCalkins)
Moderator

>On my computer, QB64 seems to use just one cpu core

This is because the QB64 code that you write is executed in one thread.

>I think this might be the reason for the slow graphical effects.

One thing to do to slightly improve the performance of QB64 code is to use:

$CHECKING:OFF

>Is there any way to allow QB64 to use the GPU?

I'm sure there is. You would probably want to go through a library. OpenGL and Direct3D are the main graphics libraries. I have no idea what their anti-aliasing capabilities are.

You might try asking on the other forums:

http://www.qb64.net/forum/

A few of the people there have OpenGL experience.

Regards,
Michael

Posted on Jul 16, 2012, 8:37 AM

Respond to this message   

Return to Index


Re: Can QB64 use the gpu?

by (no login)

What does the $CHECKING:OFF statement do?

Thanks

Posted on Jul 16, 2012, 9:19 AM

Respond to this message   

Return to Index


It disables some of the error checking.

by (Login MCalkins)
Moderator

QB64 usually generates extra code to handle errors. $CHECKING:OFF disables that.

Compare "internal\temp\main.txt" with and without...

Regards,
Michael

Posted on Jul 16, 2012, 9:31 AM

Respond to this message   

Return to Index


*Oh ok

by (no login)

Posted on Jul 16, 2012, 11:12 AM

Respond to this message   

Return to Index


New computer using QuickBasic

by (Login emoneo)

I'm thinking of buying a new computer. My present computer has Windows XP, and runs QuickBasic just fine when I run from the commandline of Windows DOS. Most new machines come with Windows 7. Will I still be able to run QuickBAsic from the commandline using Windows DOS, or will I have to use something like DOSBox?

Thanks and regards..... Moneo

Posted on Jul 12, 2012, 10:32 AM

Respond to this message   

Return to Index


Re: New computer using QuickBasic

by Pete (no login)

You will need to use DOSBox or set up something like VirtualBox and install Windows XP on it. Check into Win 7 Professional, there is supposed to be some option to run older XP programs, but if NTVDM is not included in that release, it won't work for QuickBasic.

Pete

Posted on Jul 12, 2012, 1:58 PM

Respond to this message   

Return to Index


Re: New computer using QuickBasic

by (Login emoneo)

Thanks for the info, Pete. I was afraid something like this would be the case.

Regards..... Moneo

Posted on Jul 12, 2012, 3:33 PM

Respond to this message   

Return to Index


* Thanks, Pete.

by (Login emoneo)

Posted on Jul 13, 2012, 4:55 PM

Respond to this message   

Return to Index


Re: New computer using QuickBasic

by (Login MCalkins)
Moderator

It depends on whether the Windows "7" is 32 bit or 64 bit.
If 32 bit, it will have NTVDM, and you can run QBASIC text mode programs, but not in full screen, only in a window. I don't think that you could run graphical programs.
If 64 bit, then there is no NTVDM.

Either way, you could use DOSBox, which works reasonably well, but is a bit slow.

You could boot to a FreeDOS CD or something.

You could, of course, use QB64.

Regards,
Michael

Posted on Jul 12, 2012, 6:29 PM

Respond to this message   

Return to Index


* Thanks, Michael.

by (Login emoneo)

Posted on Jul 13, 2012, 11:09 AM

Respond to this message   

Return to Index


*yw

by (Login MCalkins)
Moderator

Posted on Jul 13, 2012, 6:49 PM

Respond to this message   

Return to Index


Poke???

by (no login)

hello all, could someone explain to me what Poke is used for? I looked up the definition but I still don't understand. Does anyone have any simple programs that demonstrate its use?

Posted on Jul 10, 2012, 4:11 PM

Respond to this message   

Return to Index


It's for writing to memory.

by (Login MCalkins)
Moderator

first of all, are you familiar with hexadecimal numbers? If not, it would be a good idea to become familiar with them, as memory addresses are almost always in hexadecimal numbers. In QBASIC, hexadecimal numbers are preceded by &H, whereas in almost everything else, they are preceded by 0x. In short, it is a base 16 number system, using numerals "0" to "f".

http://en.wikipedia.org/wiki/Hexadecimal

QBASIC 1.1 was designed to run in x86 "real mode".

This means that memory addresses will have a 16 bit segment and a 16 bit offset. These are usually separated by a colon. So, for example, the CGA color text mode buffer starts at memory address:

&hb800 : &h0

Where &hb800 is the segment, and &h0 is the offset.

In "real mode", the linear memory address is determined by multiplying the segment by 16 (hex: &h10), and adding it to the offset. So the linear address would be &hb80000. You could, for example, get the same linear address with a segment/offset of &hb7ff:&h10, but there's usually no reason to mess around like that.

Let's say that you want to write directly to the CGA color text buffer. It starts at &hb800:0000, and it is an array of byte pairs. One byte for the character value, the next byte for the color attribute.

In QBASIC, you set the segment with DEF SEG, like this:

DEF SEG = &HB800

Then you can PEEK and POKE while specifying the offsets.

CLS
DEF SEG = &HB800        ' CGA color text buffer
POKE 0, 1               ' smiley face chr$(1)
POKE 1, &H1F            ' blue, bright white
POKE 2, 4               ' diamond chr$(4)
POKE 3, &HCE            ' blinking, red, bright yellow
END

Have a look at the program in this post:
http://www.network54.com/Forum/632471/message/1231888944/

It should be said that the x86 "real mode" is quite obsolete. QB64 gives you 32 bit (or 64 bit) offsets.

Regards,
Michael



    
This message has been edited by MCalkins on Jul 10, 2012 4:44 PM

Posted on Jul 10, 2012, 4:43 PM

Respond to this message   

Return to Index


thanks

by nick (no login)

That was an excellent explanation. Thank you! :)

Posted on Jul 18, 2012, 6:15 AM

Respond to this message   

Return to Index


a little more...

by (Login MCalkins)
Moderator

You're welcome.

One other thing:

You can use VARSEG() and VARPTR() to find the address of variables. This works well for numeric variables and fixed length strings.

fixed length string example:

----------

DECLARE FUNCTION hexb$ (n AS INTEGER)
DIM i AS INTEGER
DIM t AS STRING * 5

t = "abcde"

CLS

DEF SEG = VARSEG(t)

FOR i = 0 TO LEN(t) - 1
 PRINT "&h"; hexb(PEEK(VARPTR(t) + i)); ",";
NEXT i
PRINT

POKE VARPTR(t) + 2, 2 'insert a smiley face in the middle of the string

PRINT t
END

FUNCTION hexb$ (n AS INTEGER)
 DIM t AS STRING
 t = LCASE$(HEX$(n))
 IF 1 = LEN(t) THEN t = "0" + t
 hexb = t
END FUNCTION

----------

You can do the same with the numeric types. INTEGERs are 2 bytes long, LONGs and SINGLEs are 4 bytes, DOUBLEs are 8 bytes. You can see how the numbers are actually stored. The integers (INTEGER and LONG) are stored in little endian (meaining the bytes are in low to high order). The floats (SINGLE and DOUBLE) are in IEEE 757-1985 format.

(You'll find that this concept is related to the ASC, CVI, CVL, CVS, CVD, CHR$, MKI$, MKL$, MKS$, MKD$ family of functions.)

Here is an example demonstrating reading a LONG:

----------

DECLARE FUNCTION hexb$ (n AS INTEGER)
DIM i AS INTEGER
DIM t AS LONG

t = &H12345678

CLS

DEF SEG = VARSEG(t)

FOR i = 0 TO LEN(t) - 1
 PRINT "&h"; hexb(PEEK(VARPTR(t) + i)); ",";
NEXT i
PRINT
END

FUNCTION hexb$ (n AS INTEGER)
 DIM t AS STRING
 t = LCASE$(HEX$(n))
 IF 1 = LEN(t) THEN t = "0" + t
 hexb = t
END FUNCTION

----------

Variable length strings are a little trickier. There is a function, SADD(), that returns the actual address of the string, but you want to be careful with that, because QBASIC moves variable length strings around. You should consider the address of the string to be fairly volatile. VARPTR() will give you the location of the string descriptor, which is a 4 byte structure that contains both the address of the string, and it's current length. You shouldn't manipulate the descriptor manually, and you should only use the address of the string itself if you are confident that it won't move while you're using it.

Also, dynamic arrays can move when you resize them (the segment can change).

Note: this all applies to QBASIC 1.1. PDS/QBX 7.1 added far strings. QB64, while it does a good job of emulating QBASIC 1.1, has it's own abilities and ways of doing things, although some of the same concepts apply.

----------

If you like playing around with direct memory access, you might like to have a browse through the rest of the assembly language forum:

http://www.network54.com/Forum/632471/

(The link that I gave you before was to a post I had written as part of a mini-"tutorial" in that forum.)

In that forum, Artelius gave a link to a book:
http://www.petesqbsite.com/sections/tutorials/tutorials/winer.zip

Just keep in mind that anything dealing with real mode memory access and/or DOS is pretty much obsolete. If you decide to learn assembly language, for example, don't get stuck on just the real mode and/or DOS stuff.

Regards,
Michael

Posted on Jul 18, 2012, 8:35 AM

Respond to this message   

Return to Index


using locate for printer

by (no login)

I have redirected LPT1 printer port to my USB printer. This works fine for printing the program listing from qbasic. When I use LPRINT it will print but only one position on the paper. Using the locate cmd does not seem to do any thing.
Any Ideas?
Leon

Posted on Jul 10, 2012, 12:08 PM

Respond to this message   

Return to Index


A printer prints down the page

by (Login burger2227)
R

You cannot LOCATE the printer head position. To indent use spaces.

Posted on Jul 10, 2012, 1:31 PM

Respond to this message   

Return to Index


printer

by Leon Schrecengost (no login)

Thanks

Posted on Jul 10, 2012, 2:37 PM

Respond to this message   

Return to Index


Printing to a printer

by Solitaire (Login Solitaire1)
S

I wrote the following program over 10 years ago, for printing a document of several pages to an LPT printer. Don't know if it applies to your present situation, but maybe this can give you some hints:

==========================================================================
DIM N AS INTEGER, t AS INTEGER, j AS INTEGER, sentence AS STRING
DIM wrongflag AS INTEGER, pp AS INTEGER, row AS INTEGER, page AS INTEGER
CONST FALSE = 0, TRUE = NOT FALSE: wrongflag = FALSE
CLS   'Prints multiple pages with page numbers; ejects each page
PRINT "Number of lines to a page vary for each printer."
PRINT "Default for inkjet printers is 61, dot matrix is 65."
INPUT "Enter number of lines to a page for your printer:  ", pp
INPUT "Enter number of items to list:  ", N
ON ERROR GOTO continue
LPRINT TAB(30); "THIS IS THE HEADING"; TAB(70); "Page 1"
IF wrongflag = TRUE THEN
    wrongflag = FALSE
    PRINT : BEEP
    PRINT "Printer error.  Printer not connected "
    PRINT "or incompatible with software."
    END
END IF
LPRINT
sentence$ = "This is a sample line printout."
row = 2: page = 1
FOR t = 1 TO N
    row = row + 1
    LPRINT t; TAB(10); sentence$
    IF N > pp AND row = pp THEN
        row = 4
        page = page + 1
        LPRINT CHR$(12)
        LPRINT TAB(30); "NEW PAGE HEADING"; TAB(70); "Page"; page
        LPRINT
    END IF
NEXT t
FOR j = row TO pp  'ejects paper from printer
    LPRINT
NEXT j
END

continue:
wrongflag = TRUE
RESUME NEXT

Posted on Jul 12, 2012, 8:53 AM

Respond to this message   

Return to Index


Online BASIC system with subroutines and REPL

by foo (no login)

http://repl.it

It has SUBs and FUNCTIONs but GOSUB doesn't seem to work. There is no graphics capability; only line-oriented text output. I guess you can use it to solve math or science problems if you are on a computer where you can't install anything. It also has Python and Scheme interpreters available online.

Posted on Jul 4, 2012, 3:47 PM

Respond to this message   

Return to Index


Missing file?

by (no login)

When I downloaded QB64 the folder DATA was not included. The tutorials keep mentioning the need for that folder. This is confusing to me and I would really appreciate getting that folder if it is in fact essential to building programs. Thank you for the QB64.

Posted on Jul 4, 2012, 6:51 AM

Respond to this message   

Return to Index


what tutorials?

by (Login MCalkins)
Moderator

Here is the folder structure of QB64. The only "data" folder is in one of Pete's samples.

Regards,
Michael

└───qb64
    ├───internal
    │   ├───c
    │   │   ├───bin
    │   │   ├───i
    │   │   ├───i686-w64-mingw32
    │   │   │   ├───bin
    │   │   │   ├───include
    │   │   │   │   ├───ddk
    │   │   │   │   ├───GL
    │   │   │   │   ├───psdk_inc
    │   │   │   │   ├───sdks
    │   │   │   │   ├───sec_api
    │   │   │   │   │   └───sys
    │   │   │   │   └───sys
    │   │   │   └───lib
    │   │   │       └───ldscripts
    │   │   ├───include
    │   │   │   └───c++
    │   │   │       └───4.6.1
    │   │   │           ├───backward
    │   │   │           ├───bits
    │   │   │           ├───debug
    │   │   │           ├───decimal
    │   │   │           ├───ext
    │   │   │           │   └───pb_ds
    │   │   │           │       └───detail
    │   │   │           │           ├───basic_tree_policy
    │   │   │           │           ├───binary_heap_
    │   │   │           │           ├───binomial_heap_
    │   │   │           │           ├───binomial_heap_base_
    │   │   │           │           ├───bin_search_tree_
    │   │   │           │           ├───cc_hash_table_map_
    │   │   │           │           ├───eq_fn
    │   │   │           │           ├───gp_hash_table_map_
    │   │   │           │           ├───hash_fn
    │   │   │           │           ├───left_child_next_sibling_heap_
    │   │   │           │           ├───list_update_map_
    │   │   │           │           ├───list_update_policy
    │   │   │           │           ├───ov_tree_map_
    │   │   │           │           ├───pairing_heap_
    │   │   │           │           ├───pat_trie_
    │   │   │           │           ├───rb_tree_map_
    │   │   │           │           ├───rc_binomial_heap_
    │   │   │           │           ├───resize_policy
    │   │   │           │           ├───splay_tree_
    │   │   │           │           ├───thin_heap_
    │   │   │           │           ├───tree_policy
    │   │   │           │           ├───trie_policy
    │   │   │           │           └───unordered_iterator
    │   │   │           ├───i686-w64-mingw32
    │   │   │           │   └───bits
    │   │   │           ├───profile
    │   │   │           │   └───impl
    │   │   │           └───tr1
    │   │   ├───l
    │   │   ├───lib
    │   │   │   └───gcc
    │   │   │       └───i686-w64-mingw32
    │   │   │           └───4.6.1
    │   │   │               ├───include
    │   │   │               │   ├───objc
    │   │   │               │   │   └───deprecated
    │   │   │               │   └───ssp
    │   │   │               ├───include-fixed
    │   │   │               └───install-tools
    │   │   │                   └───include
    │   │   ├───libexec
    │   │   │   └───gcc
    │   │   │       └───i686-w64-mingw32
    │   │   │           └───4.6.1
    │   │   │               └───install-tools
    │   │   ├───mingw
    │   │   │   ├───bin
    │   │   │   ├───include
    │   │   │   │   ├───ddk
    │   │   │   │   ├───GL
    │   │   │   │   ├───psdk_inc
    │   │   │   │   ├───sdks
    │   │   │   │   ├───sec_api
    │   │   │   │   │   └───sys
    │   │   │   │   └───sys
    │   │   │   └───lib
    │   │   │       └───ldscripts
    │   │   └───share
    │   │       ├───gcc-4.6.1
    │   │       │   └───python
    │   │       │       └───libstdcxx
    │   │       │           └───v6
    │   │       ├───gdb
    │   │       │   ├───python
    │   │       │   │   └───gdb
    │   │       │   │       └───command
    │   │       │   └───syscalls
    │   │       ├───info
    │   │       └───man
    │   │           ├───man1
    │   │           └───man7
    │   ├───help
    │   ├───temp
    │   └───update
    │       └───downloads
    ├───samples
    │   ├───n54
    │   │   └───big
    │   │       └───3dsviewer
    │   ├───pete
    │   │   ├───25lines
    │   │   ├───beatdown
    │   │   ├───booger
    │   │   │   ├───data
    │   │   │   └───levels
    │   │   ├───cr
    │   │   ├───darpong
    │   │   ├───hgm30e
    │   │   ├───html
    │   │   ├───invader1
    │   │   ├───monopoly
    │   │   ├───mooncr
    │   │   ├───nlcm2006
    │   │   ├───optimus
    │   │   ├───pongtennis
    │   │   ├───pp256
    │   │   │   ├───clips
    │   │   │   ├───grads
    │   │   │   ├───images
    │   │   │   ├───palettes
    │   │   │   └───screens
    │   │   ├───rectong
    │   │   │   └───gfx
    │   │   ├───roboraid
    │   │   ├───simpire
    │   │   ├───su2
    │   │   ├───tank
    │   │   ├───tor
    │   │   └───wetspot
    │   ├───qb45com
    │   │   └───action
    │   │       ├───arcdemo
    │   │       ├───arqanoid
    │   │       │   ├───images
    │   │       │   ├───levels
    │   │       │   └───saves
    │   │       ├───assault
    │   │       │   ├───backgrnd
    │   │       │   └───sound
    │   │       └───sfb2
    │   ├───qb64
    │   │   └───original
    │   └───thebob
    │       ├───abacus
    │       ├───animax
    │       ├───biochart
    │       ├───chess
    │       ├───chopper
    │       ├───kong
    │       ├───leapfrog
    │       ├───minigolf
    │       ├───monopoly
    │       ├───pongg
    │       ├───rattler
    │       └───sol
    └───source



    
This message has been edited by MCalkins on Jul 4, 2012 7:22 AM

Posted on Jul 4, 2012, 7:19 AM

Respond to this message   

Return to Index


Perhaps in an earlier release of QB64? ...

by (Login qb432l)
R

I have an installation of QB64 that includes a DATA folder.

\data
\GL
\internal
\newfile
\samples
\SFML
\smileyface
\source

-Bob



    
This message has been edited by qb432l on Jul 4, 2012 9:06 AM

Posted on Jul 4, 2012, 7:53 AM

Respond to this message   

Return to Index


If you never physically removed it, it will still be there...

by (Login burger2227)
R

Newer versions of QB64 don't need the Data folder anymore. All it held was images.

Posted on Jul 4, 2012, 8:45 PM

Respond to this message   

Return to Index


Random Names

by (Login STBasic)

I have eight names that i need to pick into 8 groups.

can this be done within a sub

and how is done

Posted on Jul 3, 2012, 2:33 AM

Respond to this message   

Return to Index


Re: Random Names

by (Login MCalkins)
Moderator

You're going to have to be more specific. Is this a homework assignment?

What do you mean "8 groups"? Do you mean 8 groups of 1 name each? Or 8 groups of the same 8 names, but in different orders?

Most things can be done in a SUB, or several SUBs/FUNCTIONs. Please be more specific.

Regards,
Michael

Posted on Jul 3, 2012, 7:07 AM

Respond to this message   

Return to Index


Forcing Fullscreen Toggle via Code

by (no login)

I am interested in being able to write some code that would invoke the ALT + ENTER full screen toggle in QBasic. I have looked into using the POKE command to modify the status byte of the keyboard with no luck. The built in POKE example in QBasic that simply toggles the NumLock, Caps Lock, and Scroll Lock on\off doesn't even function correctly with my keyboard(I think it's my keyboard). I believe this is because my keyboard device is of type HID and the location of the keyboard's status byte may be in a different location. This is just a theory.

I think the keyboard status byte is the key to this solution but does anyone know if the location of the keyboard status byte changes from keyboard to keyboard? Does anyone know of quick way to force QBasic to ALT + ENTER itself using code? Thanks in advance everyone and I appreciate any and all efforts to help me with my situation! (:

Posted on Jul 1, 2012, 10:10 AM

Respond to this message   

Return to Index


re: (added 1 PS)

by (Login MCalkins)
Moderator

I don't think QBASIC 1.1 could do this directly. If a Win32 program could do it, you might be able to SHELL to the win32 program to do it...

I strongly suspect that you could do something like that, though not with POKE, in QB64, but I'm not sure the exact method.

Regards,
Michael

P.S.

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



    
This message has been edited by MCalkins on Jul 1, 2012 1:49 PM

Posted on Jul 1, 2012, 1:46 PM

Respond to this message   

Return to Index


response

by (no login)

I am unfortunatley using a 32 bit system, yet would QB64 work anyway?

Also, QBasic can run in windowed mode and when a program executes and does a SCREEN 12 command, the console window automatically goes fullscreen. Is there source code somewhere on how the SCREEN command works in order to accomplish this? If I could utilize such code, perhaps I could reverse the algorithm in order to be able to force a windowed mode( or vica versa).

Thanks for responding so quickly earlier by the way!

Posted on Jul 1, 2012, 4:40 PM

Respond to this message   

Return to Index


Re: response

by (Login MCalkins)
Moderator

Yes, the Windows version of QB64 creates 32 bit programs that will run on 32 or 64 bit Windows. They will run on XP and later, including Vista and "7". (It is possible to jump through hoops to get it to run on Windows 2000, but it won't do so by default.)

forums:
http://www.qb64.net/forum/

version 0.954 (current at this time):
http://www.qb64.net/forum/index.php?topic=6007.0

I recommend the .7z file, because it is significantly smaller. You can get 7-zip here:
http://www.7-zip.org/

-----

QBasic, as with other DOS programs, has no knowledge of running in a window. When it switches to Screen 12, all it knows is that it just told the BIOS to switch the VGA adapter from a text mode to a graphical mode. It has no knowledge of Windows.

Meanwhile, Windows is running QBASIC in a virtual DOS machine, sees the request to switch the graphics mode, and decides to make the program full screen.

-----

Here is a C++ program that will call the Windows API's SetConsoleDisplayMode() function.

http://msdn.microsoft.com/en-us/library/ms686028%28v=vs.85%29

Note that it requires Windows XP or 2003. (Vista/"7" don't do fullscreen consoles.)

conwfs.cpp --------------------------------

// public domain, 2012 july, michael calkins
// http://www.network54.com/Forum/648955/message/1341162659/

#include <windows.h>
// #include <stdio.h>

// MinGW's wincon.h seems to be missing some things...

#if !defined CONSOLE_FULLSCREEN_MODE
 #define CONSOLE_FULLSCREEN_MODE 1
#endif
#if !defined CONSOLE_WINDOWED_MODE
 #define CONSOLE_WINDOWED_MODE 2
#endif
#if !defined SetConsoleDisplayMode
 extern "C" { WINBASEAPI BOOL WINAPI SetConsoleDisplayMode(HANDLE hConsoleOutput, DWORD dwFlags, PCOORD lpNewScreenBufferDimensions); }
#endif

HANDLE hsb;
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), 0, 0};
COORD d;

int main(int argc, char * argv[]) {              // MinGW does not support wmain()

 hsb = CreateFileW( L"CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & sa, OPEN_EXISTING, 0, 0);
 if (hsb == INVALID_HANDLE_VALUE) {
  // printf("CreateFileW failed. 0x%x\n", GetLastError());
  return 1;                                      // CreateFileW() failed.
 }
 if (argc < 2) return 2;                         // Missing command line parameter.

 switch (*argv[1]) {
  case '1':
   if (SetConsoleDisplayMode(hsb, CONSOLE_FULLSCREEN_MODE, & d)) return 0;
   break;
  case '2':
   if (SetConsoleDisplayMode(hsb, CONSOLE_WINDOWED_MODE, & d)) return 0;
   break;
  default:
   return 3;                                     // Invalid command line parameter.
 }
 // printf("SetConsoleDisplayMode failed. 0x%x\n", GetLastError());
 // seems to fail with 0x57 if you're already in that mode...
 return 4;                                       // SetConsoleDisplayMode() failed.
}

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

You'll need a C++ compiler with Windows headers to compile it. If you have QB64, then you can execute:

internal\c\bin\g++ -s conwfs.cpp -o conwfs.exe

where "internal" is a subfolder of the QB64 folder.

I could upload the executable (12KB) to my website, but I am reluctant to do so without a good reason. I would prefer that you compile it from source, if possible.

-----

The program expects 1 parameter, of which it checks the first character:

conwfs.exe 1
to go to full screen.

conwfs.exe 2
to go to a window.

The program returns exit codes that you can check from a .BAT file using echo %errorlevel%. A code of 0 means success. A code of 1 means it couldn't open "CONOUT$" using CreateFileW(). A code of 2 means you forgot the parameter. A code of 3 means the first character of the parameter was something other than "1" or "2". A code of 4 means the call to SetConsoleDisplayMode() failed. If you want to see the Windows error codes, uncomment the #include <stdio> and the two printf() lines.

-----

Here is a QBASIC 1.1 program that SHELLs to it to alternate modes every 3 seconds:

DO
 SHELL "conwfs.exe 1" 'full screen
 ' WIDTH 80, 25
 SLEEP 3
 IF LEN(INKEY$) THEN EXIT DO
 SHELL "conwfs.exe 2" 'windowed
 SLEEP 3
LOOP UNTIL LEN(INKEY$)
SYSTEM

-----

Regards,
Michael

Posted on Jul 2, 2012, 6:32 AM

Respond to this message   

Return to Index


response

by (no login)

This code looks exactly like what I have been looking for! I will test it out tonight, but I had one more question with regard to the keyboard status byte. Do you know if the memory location of the keyboard status byte is different for HID keyboard devices? The QBasic example(and every example I've found online) uses POKE to modify the bits around &417 and &418 to toggle NumLock, etc. on\off. The examples run yet don't seem to do anything. Are you able to get a result with such examples?

Posted on Jul 2, 2012, 10:26 AM

Respond to this message   

Return to Index


Re: response

by (Login MCalkins)
Moderator

I don't think that the type of keyboard matters. Windows is providing, through NTVDM, an emulated DOS / IBM BIOS environment to the DOS programs, including QBASIC. It seems that NTVDM will let you read the status byte, but seems to ignore writes to it.

You can correctly read the byte at 0000:0417, you just can't set the locks by writing to it, right?

I wrote a QB64 program here:

http://www.qb64.net/forum/index.php?topic=5878.msg60700#msg60700

that uses the Windows API function SendInput() to simulate pressing the lock keys.

http://msdn.microsoft.com/en-us/library/ms646310%28v=vs.85%29

Let me know if you need a C++ program to SHELL to from QBASIC 1.1. However, you might prefer switching to QB64.

Regards,
Michael



    
This message has been edited by MCalkins on Jul 3, 2012 7:05 AM

Posted on Jul 3, 2012, 7:03 AM

Respond to this message   

Return to Index


MAYBE HERE ...

by OPRESION (no login)

IN "DAV'S QBAISC SITE" LOOK FOR:

'Force Full-Screen DOS Box'

BUT THAT CODE NEVER HAVE WORKED FOR ME.

ALSO IN THIS FORUM IN THE 'ARCHIVE SECTION' GO TO:

http://www.network54.com/Forum/13959/message/1122752595/Here---

YOU WILL FIND THE EXECUTABLE THAT I AM USING.
IT WORKS FOR ME BECAUSE I AM USING WINDOWS 98SE.

Posted on Jul 1, 2012, 11:20 PM

Respond to this message   

Return to Index


Copy files & folders according to list ?

by (no login)

For syncing a main drive with a backup drive. Anyway i'm so scared to mess up every thing that i go manual.

Posted on Jun 28, 2012, 7:34 AM

Respond to this message   

Return to Index


Re: Copy files & folders according to list ?

by (no login)

Could you give a little more information, I'm not sure what your'e asking.

Posted on Jun 30, 2012, 9:12 AM

Respond to this message   

Return to Index


ok

by (no login)

On my main PC, one drive is full. So i plugged in another drive. The problem is to keep the backup drive (an usb device) synchronised with the changes on the PC.

So for example, i will move a bunch of files and folders to the new drive on the main PC, but i have to keep track about this in order to move the same files on the backup drive... which keeps the same folder structure, as the PC, logically since it's a backup drive;

This is rather a job for a batch program... or manually.

Posted on Jul 1, 2012, 6:27 AM

Respond to this message   

Return to Index


Re: ok

by (Login MCalkins)
Moderator

yeah, there are various ways of doing that.

Back in the old DOS days, when a file was modified the "A" (archive) attribute would be set. You could then copy all the files with the "A" attribute, and then remove the attribute from the source files.

You could write a QBASIC program to dump "dir" lists to files, and parse the files, looking for new files, or files with mismatching sizes and datestamps.

If you wanted to be extra sure, you could do binary comparisons of the files, or make a list of SHA-1 hashes of the backup files, then check the hashes of the new files against the list to see if there are new files. You could also use a list of hashes to detect duplicate files.

You might look into seeing if anyone else has written good synchronization software, rather that writing your own. (I know this is a programming forum with a strong hobby leaning, but sometimes it's easier and better to use someone else's program, unless you really want to write your own.)

Regards,
Michael

Posted on Jul 1, 2012, 1:42 PM

Respond to this message   

Return to Index


Full backup versus partial backup

by (Login emoneo)

Partial or selective backups are error-prone in my opinion and experience.
Given the speed of today's computers and devices, the best solution for backups is a full backup. This method ensures that you have an exact copy of all the sub-directories and their respective files. To eliminate the possibility of underlay (old) directories and files, clear the destination before performing the copy-backup. At the end of the copy-backup, do a DIR of the source and destination to ensure that the size and number of files match.
Regards..... Moneo

Posted on Jul 1, 2012, 5:27 PM

Respond to this message   

Return to Index


More regarding backups

by Moneo (no login)

Hi lisztfr,
I did some more thinking about your backup needs.
If you choose not to use the full backup that I mentioned in my last post, perhaps because you are dealing with too many files, then I suggest using the XCOPY command.
To view the help information on the XCOPY command, do: XCOPY /?
To get this help info onto a text file for easy reading,do:
XCOPY /? > xcopy.txt
NOTES:
1) Before your very first backup, you need to backup ALL your files just once, as follows:
XCOPY source destination
This establishes your initial "database" which you will selectively update.
2) In general, I recommend NOT using the archive attribute for selecting recently changed files, since there is much chance for error.
3) In order to selectively backup your files on or after the date of 08-31-2012, for example, use XCOPY as follows:
XCOPY source destination /d:08-31-2012
4) I did some simple testing, and it works fine.
5) Note in the help information that XCOPY will handle directories and sub-directories. I didn't test this.
6) If you wish, you might create a simple batch file which substitutes the date as a parameter.
Good luck..... Moneo

Posted on Aug 31, 2012, 5:09 PM

Respond to this message   

Return to Index


Thanks Moneo

by (no login)

The trick with the date attribute is nice, i didn't know this...

I was already using xxcopy sometimes, with exclude list too. In someway i solved my problems, manually.

Something else : my Freecom 750 GB drive seems underpowered, on windows, while on linux (Puppy) it is still readable ! Previously Windows XP could access it, but now, i don't know why, suddenly my IBM T43 seems to have not enough power (Also other laptops). While Puppy can read is very nicely...

Cheers, l

Posted on Sep 4, 2012, 2:37 AM

Respond to this message   

Return to Index


Ideas

by (no login)

I am bored and looking for a new project to work on. Any ideas of programs i could make?

Posted on Jun 27, 2012, 8:42 PM

Respond to this message   

Return to Index


write a graphing calculator of some sort

by Cock (no login)

Posted on Jun 28, 2012, 12:07 AM

Respond to this message   

Return to Index


Toast

by Solitaire (no login)

User enters degree of darkness to toast a slice of bread. Gradually darken a rectangle from beige to brown, up the the user's input. When done, display "Toast is ready."

(I wrote this program in VB. Can you do it in QB?)

Posted on Jun 28, 2012, 7:56 AM

Respond to this message   

Return to Index


*url inside

by Solitaire (no login)

Toast:

http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/cc5e9255-b80a-4814-bb20-b3fb79ebe943

Posted on Jun 28, 2012, 7:58 AM

Respond to this message   

Return to Index


Re: Toast

by (no login)

Here :)
100 seems to make some nice toast.


_TITLE "Toast"
SCREEN _NEWIMAGE(640, 480, 32)
DO
CLEAR
REDIM toasts(307200)
DO
_LIMIT 64
CLS
k$ = INKEY$
PRINT "Enter a value to toast the bread: "; toastdeg$
IF k$ >= CHR$(32) AND k$ <= CHR$(126) THEN toastdeg$ = toastdeg$ + k$
IF k$ = CHR$(8) AND LEN(toastdeg$) <> 0 THEN toastdeg$ = MID$(toastdeg$, 1, (LEN(toastdeg$) - 1))
IF k$ = (CHR$(0) + CHR$(83)) THEN toastdeg$ = ""
IF k$ = CHR$(27) THEN SYSTEM
_DISPLAY
LOOP UNTIL k$ = CHR$(13)
toastdeg = VAL(toastdeg$)
DO
_LIMIT 10
CLS
k$ = INKEY$
PAINT (1, 1), _RGBA(238, 232, 170, 255)
u = 0
FOR x = 0 TO 639
FOR y = 0 TO 478
u = u + 1
nowtoast = toasts(u)
z = INT(RND * 2 + 1)
IF z = 1 THEN nowtoast = nowtoast + 1
IF nowtoast < 40 THEN nowtoast = 40
PSET (x, y), _RGBA(1, 1, 1, nowtoast)
toasts(u) = nowtoast
NEXT y
NEXT x
i = i + 1
_PRINTMODE _KEEPBACKGROUND
_PRINTSTRING (1, 1), STR$(i)
IF k$ = CHR$(27) THEN SYSTEM
_DISPLAY
LOOP UNTIL i = toastdeg
_PRINTMODE _KEEPBACKGROUND
_PRINTSTRING (260, 192), "Toast is ready."
_DISPLAY
_DELAY 3
_PRINTMODE _KEEPBACKGROUND
_PRINTSTRING (176, 208), "Would you like to toast again? (y/n)"
_DISPLAY
DO
_LIMIT 64
k$ = INKEY$
LOOP UNTIL k$ = CHR$(121) OR k$ = CHR$(89) OR k$ = CHR$(110) OR k$ = CHR$(78)
LOOP UNTIL k$ = CHR$(110) OR k$ = CHR$(78)
SYSTEM

Posted on Jun 30, 2012, 9:10 AM

Respond to this message   

Return to Index


Proper Case of Name (project idea; could be a challenge)

by Solitaire (no login)

Write a program that will take user's input of a full name and display it in Proper Case -- each name starting with an uppercase letter and remaining letters in lowercase. In addition, if name begins with Mc, Mac, or includes a ', the letter coming after that should also be in uppercase.

I wrote such a program over 4 years ago. Now do it yourself. I'm curious as to how your code will differ from mine. Please use code that is compatible with QB, not QB64.

Sorry, I haven't been able to run your version of the Toast program, as it doesn't work with QB and I don't have QB64 installed on my laptop. (My desktop computer is in the attic and it's stifling hot up there during the current heat wave, so I won't turn it on.)


Please respond to the subforum, so other programmers may participate:

http://www.network54.com/Forum/202193/message/1341242170/Proper+Case+of+Name



    
This message has been edited by Solitaire1 on Jul 2, 2012 9:01 AM
This message has been edited by Solitaire1 on Jul 2, 2012 9:00 AM

Posted on Jul 2, 2012, 8:09 AM

Respond to this message   

Return to Index


Re: Proper Case of Name (project idea; could be a challenge)

by (Login emoneo)

Not all last names begin with an uppercase letter. Last names originating in other languages can begin with lowercase letters. Examples:
Peter van der Lee
Ernesto de la Cueva
Michael de la Rosa

Sometimes multiple last names in Spanish contain a "y" meaning "and", like:
Juan Perez y Sanchez

All these combinations are possible in the USA which has names for people originating in different countries.

Regards..... Moneo

Posted on Jul 2, 2012, 6:04 PM

Respond to this message   

Return to Index


* Also, beware of diacritical marks on letters

by (Login emoneo)

*



    
This message has been edited by Solitaire1 on Jul 3, 2012 8:49 AM

Posted on Jul 2, 2012, 6:14 PM

Respond to this message   

Return to Index


There are many exceptions. (another challenge)

by Solitaire (Login Solitaire1)
S

Yes, I was aware of that, especially after looking over the list of names in the Manhattan phone book. But there's so much that needs to be considered that would require a great deal of code. I simply included the most common exceptions to work by, and asked the user to add a ~ for bypassing the rule. If you have more rules, you could list them and ask the user if he wants to make certain exceptions.

I also wrote a similar program (in VB) to use Title Case for titles of books, etc. If you Google "Title Case" you will find a confusing array of rules for which words should be left in lowercase. This is even more challenging than the program for proper name case.

Zack, you may want to try that version next.



    
This message has been edited by Solitaire1 on Jul 3, 2012 9:02 AM

Posted on Jul 3, 2012, 9:01 AM

Respond to this message   

Return to Index


Re: Proper Case of Name (project idea; could be a challenge)

by (no login)

This works, I tested it a little and it didn't make any mistakes. I would test it more but it is getting late, maybe tomorrow. It was actually more work than I thought it would be ;D I don't use QBasic, nor have I ever, so I to try and make it compatible I didn't use any _ commands. Sorry if it is still incompatible.

SCREEN 12
DO
CLEAR
DO
CLS
PRINT "Enter your name: "; name$
DO
k$ = INKEY$
LOOP UNTIL k$ = ""
DO
k$ = INKEY$
LOOP UNTIL LEN(k$)
IF k$ >= CHR$(32) AND k$ <= CHR$(126) THEN name$ = name$ + k$
IF k$ = CHR$(8) AND LEN(name$) <> 0 THEN name$ = MID$(name$, 1, (LEN(name$) - 1))
IF LEN(name$) > 64 THEN name$ = MID$(name$, 1, (LEN(name$) - 1))
LOOP UNTIL k$ = CHR$(13)
namesave$ = name$
FOR lowercase = 1 TO LEN(name$)
character$ = MID$(name$, lowercase, 1)
IF character$ >= CHR$(65) AND character$ <= CHR$(90) THEN character$ = CHR$((ASC(character$) + 32))
IF character$ = CHR$(32) OR character$ = CHR$(39) OR character$ = CHR$(45) OR character$ = CHR$(46) OR (character$ >= CHR$(65) AND character$ <= CHR$(90)) OR (character$ >= CHR$(97) AND character$ <= CHR$(122)) OR (character$ >= CHR$(128) AND character$ <= CHR$(154)) OR (character$ >= CHR$(160) AND character$ <= CHR$(165)) THEN namex$ = namex$ + character$
NEXT lowercase
name$ = namex$
DO
nodisturb = 0
IF INSTR(name$, "mr") AND MID$(name$, (INSTR(name$, "mr") + 2), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "mr") + 1)) + "." + MID$(name$, (INSTR(name$, "mr") + 2), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "dr") AND MID$(name$, (INSTR(name$, "dr") + 2), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "dr") + 1)) + "." + MID$(name$, (INSTR(name$, "dr") + 2), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "ms") AND MID$(name$, (INSTR(name$, "ms") + 2), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "ms") + 1)) + "." + MID$(name$, (INSTR(name$, "ms") + 2), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "mrs") AND MID$(name$, (INSTR(name$, "mrs") + 3), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "mrs") + 2)) + "." + MID$(name$, (INSTR(name$, "mrs") + 3), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "rev") AND MID$(name$, (INSTR(name$, "rev") + 3), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "rev") + 2)) + "." + MID$(name$, (INSTR(name$, "rev") + 3), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "phd") AND MID$(name$, (INSTR(name$, "phd") + 3), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "phd") + 2)) + "." + MID$(name$, (INSTR(name$, "phd") + 3), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "prof") AND MID$(name$, (INSTR(name$, "prof") + 4), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "prof") + 3)) + "." + MID$(name$, (INSTR(name$, "prof") + 4), LEN(name$))
nodisturb = 1
END IF
LOOP UNTIL nodisturb = 0
REDIM namesplit$(64)
FOR namesplit = 1 TO LEN(name$)
namesplit$(namesplit) = MID$(name$, namesplit, 1)
NEXT namesplit
REDIM spacecheck$(64)
FOR spacecheck = 1 TO namesplit
DO
IF namesplit$(spacecheck) = CHR$(32) AND namesplit$(spacecheck + 1) = CHR$(32) THEN EXIT DO
spacechecks = spacechecks + 1
spacecheck$(spacechecks) = namesplit$(spacecheck)
EXIT DO
LOOP
NEXT spacecheck
FOR cap = 1 TO spacechecks
IF cap = 1 THEN spacecheck$(cap) = uc$(spacecheck$(cap))
IF spacecheck$(cap) = CHR$(32) THEN
cap = cap + 1
spacecheck$(cap) = uc$(spacecheck$(cap))
END IF
IF spacecheck$(cap) = CHR$(39) THEN
cap = cap + 1
spacecheck$(cap) = uc$(spacecheck$(cap))
END IF
IF cap > 3 THEN
IF (spacecheck$(cap) = CHR$(99) AND spacecheck$(cap - 1) = CHR$(97) AND spacecheck$(cap - 2) = CHR$(77)) THEN
cap = cap + 1
spacecheck$(cap) = uc$(spacecheck$(cap))
END IF
END IF
IF cap > 2 THEN
IF (spacecheck$(cap) = CHR$(99) AND spacecheck$(cap - 1) = CHR$(77)) THEN
cap = cap + 1
spacecheck$(cap) = uc$(spacecheck$(cap))
END IF
END IF
NEXT cap
FOR sew = 1 TO spacechecks
namere$ = namere$ + spacecheck$(sew)
NEXT sew
name$ = namere$
REDIM chunks$(64)
FOR chunker = 1 TO LEN(name$)
chunk$ = MID$(name$, chunker, 1)
IF chunk$ <> CHR$(32) THEN
chunks = chunks + 1
chunker = chunker - 1
DO
chunker = chunker + 1
chunk$ = MID$(name$, chunker, 1)
IF chunk$ = CHR$(32) THEN EXIT DO
chunks$(chunks) = chunks$(chunks) + chunk$
LOOP UNTIL chunker = LEN(name$)
END IF
NEXT chunker
FOR chunkmod = 1 TO chunks
SELECT CASE chunks$(chunkmod)
CASE "Von"
chunks$(chunkmod) = "von"
CASE "De"
chunks$(chunkmod) = "de"
CASE "Ver"
chunks$(chunkmod) = "ver"
CASE "La"
chunks$(chunkmod) = "la"
CASE "Del"
chunks$(chunkmod) = "del"
CASE "Van"
chunks$(chunkmod) = "van"
CASE "Der"
chunks$(chunkmod) = "der"
END SELECT
NEXT chunkmod
FOR chunksew = 1 TO chunks
nameer$ = nameer$ + chunks$(chunksew) + CHR$(32)
NEXT chunksew
name$ = nameer$
name$ = MID$(name$, 1, (LEN(name$) - 1))
CLS
PRINT "Orignal Name: "; namesave$
PRINT "Formatted Name: "; name$
PRINT "Would you like to format another name? (y/n)"
DO
k$ = INKEY$
IF k$ = CHR$(121) OR k$ = CHR$(89) OR k$ = CHR$(110) OR k$ = CHR$(78) THEN EXIT DO
LOOP
LOOP UNTIL k$ = CHR$(110) OR k$ = CHR$(78)
SYSTEM

FUNCTION lc$ (ucc$)
SELECT CASE ASC(ucc$)
CASE 65 TO 90
lc$ = CHR$((ASC(ucc$) + 32))
CASE 128
lc$ = CHR$(135)
CASE 142
lc$ = CHR$(132)
CASE 143
lc$ = CHR$(134)
CASE 144
lc$ = CHR$(130)
CASE 146
lc$ = CHR$(145)
CASE 153
lc$ = CHR$(148)
CASE 154
lc$ = CHR$(129)
CASE 165
lc$ = CHR$(164)
CASE ELSE
lc$ = ucc$
END SELECT
END FUNCTION

FUNCTION uc$ (lcc$)
SELECT CASE ASC(lcc$)
CASE 97 TO 122
uc$ = CHR$((ASC(lcc$) - 32))
CASE 135
uc$ = CHR$(128)
CASE 132
uc$ = CHR$(142)
CASE 134
uc$ = CHR$(143)
CASE 130
uc$ = CHR$(144)
CASE 145
uc$ = CHR$(146)
CASE 148
uc$ = CHR$(153)
CASE 129
uc$ = CHR$(154)
CASE 164
uc$ = CHR$(165)
CASE ELSE
uc$ = lcc$
END SELECT
END FUNCTION

Posted on Jul 2, 2012, 10:21 PM

Respond to this message   

Return to Index


* Very nice. It does work with QB. Your code is a whole lot different than mine.

by Solitaire (Login Solitaire1)
S

Posted on Jul 3, 2012, 8:48 AM

Respond to this message   

Return to Index


some more ideas:

by (Login MCalkins)
Moderator

a card game (skip-bo, hearts, spades, or free cell). In case of freecell, maybe you could make a solver. In the case of one of the other three, maybe you could make a computer AI player, or even human vs human multiplayer capability across a network.

a monopoly game, allowing normal variations in the rules. Again, you could do computer AI players or network multiplayer capability.

perhaps an interpreter / script host / virtual machine of some kind. Perhaps invent your own language. Perhaps simulate a multitasking CPU.

perhaps a good hex editor, capable of editing multiple large files. You could give it search, as well as cut/copy/paste in the same file and between files.

perhaps, investigate, understand, and implement various algorithms, such as cryptographic hashes like SHA-1 and SHA-2. Perhaps symmetric key ciphers like AES. Perhaps asymmetric key ciphers, like RSA, or ciphers basic on elliptic curves. Perhaps pseudo-random number generators. Perhaps compression algorithms.

Regards,
Michael

Posted on Jul 3, 2012, 9:39 AM

Respond to this message   

Return to Index

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