Jump to content

QuickBASIC/Starting

From Wikiversity
This is the "Starting.txt" file, 
created TUE 2011 NOV 15 06:56 PM, (Eastern Standard time)
revised SUN 2011 NOV 27 06:18 PM,
revised TUE 2012 JAN 03 07:52 PM. (mostly correcting typos and minor errorsa)

<Ray -- look for "verify", "incomplete", and "?????".> 

Mr. Ted Felix wrote a tutorial entitled, "QBasic for Kids". 
He also has a companion website, "Computer Science for Kids".
I also found the original manual for BASIC, from Dartmouth college, 
if you can bear the concepts of "time sharing" and "teletype machines".
I think we can all enjoy the material that already exists in the forums -- 
plus benefits to be gained by the opportunity to join an active user community!.

If you Google "Ted Felix", you should be able to find Ted's home page.
I will be studying his tutorials myself, but I think I must warn you first that there are MANY variations in operating systems, computer hardware, and many variations of BASIC dialects.
I hope to give you a "heads up", so that you will not be unduly discouraged when you find some differences between what Ted describes, and your own experiences. 

P. S. You can, if you want to, look for and find the ORIGINAL User's Manual for BASIC from Dartmouth College. Your laptop should allow you to do things so much more easily than the "teletype machines" and "time sharing" facilities the original authors had to use. Perhaps you will think that "ancient history" is quaint! 
~~~~

	HELLO!

Hello! I hope you have had some help getting acquainted with your
computer. I have to assume that you can find articles on the Web, 
and that you can "click" a mouse. I trust also, that you are 
actively learning to use the vocabulary of Computer Science. 

Two brief notes for beginners -- (1) executable computer programs 
are often called "apps", or "applications". (2) in computer langauge, 
"execute" does NOT mean to put your program before a firing squad. 
It only means to run your program, that is, cause it to perform 
your instructions. 

Computer hardware and software changes so rapidly, and there are 
so many (slightly) different products, that it is difficult to 
keep up! So, I am trying to report as accurately as I can my own 
current (see date above) experiences on my NEW machine. It is a 
Toshiba laptop, with the Windows 7 operating system. Again, this 
is merely fact, not an endorsement. 

I hate it when I must change from familiar hardware and software
(so did the late mister Noyce, one of the inventors of the integrated 
circuit chips which make personal computers possible). 
I must learn all over again how to do many things in new ways.
 
<Begin whine> The keyboard doesn't feel the same! Some of the 
puntuation keys are in different places. The mouse doesn't work 
the same way! Windows 7 doesn't track "recent files", or search 
for them, the same way Windows XP did! And on and on, as I am 
in the process of discovering. Much of my old software is no 
longer compatible with the new operating system. My favorite 
programs don't work any more! :-( <end whine> 

It was a MAJOR switch from Disk Operating System (DOS) to Windows. 
It was a MAJOR switch from a 16-bit operating system to a 32-bit 
operatiog system (more than a gigabyte of documentation to read!). 
But even this was not sufficient to solve all of the world's 
problems. You can't even count to five billion with only 32 bits. 
And there are more than seven billion people on this planet now. 
And I'm sure that many people have more than one problem. Now it is 
a MAJOR switch from a 32-bit operating system to a 64-bit operatiog 
system, but I am confident that I will adapt. You will, too.

I intend to use this newness as an opportunity to help beginners, 
because I am having to make a fresh new start myself. CAUTION! 
Sooner or later, you must learn to be very flexible to adapt to 
the continuing changes!

WARNING! Not everyone is a "white hat" computer user. Some Web 
sites may be used to perpetrate scams, and some sites are 
fraudulent. Ask your computer teacher at school for her advice 
on how to avoid "malware", viruses, identity theft, and other 
frauds. Also, if your computer system (hardware and software) 
is not exactly like mine, (and, it probably isn't EXACTLY), you 
will experience some differences from what I am about to describe. 
Adapt! :-|

I hope that I can help you by recording my experiences, as I 
start working with my new laptop computer. Just as there were 
many changes when I had to switch from a 16-bit operating 
system to a 32-bit system, so do I expect that there will be 
many changes when in switching from a 32-bit operating 
system to a 64-bit system. I have already discovered that many 
of my favorite (old) programs have incompatibility issues. But 
I have used QB64 sucessfully to run several of my old BASIC 
programs. They ran 10 times FASTER, and I can use windows MUCH 
LARGER than 640 pixels by 480 pixels. 

	THERE ARE MANY OTHER RESOURCES

There are many resources available for you -- you won't need 
to rely exclusively on me. In fact, I expect you to explore a 
lot. The more sources, tutorials, and sample programs you 
encounter, the more robust your working knowledge base will 
become. I do not expect you to rely entirely on me. You must 
learn for yourself, and learn to be flexible! 

For example: at the very bottom of the Official QB64 Website page, 
there is a blue rectangle, with words next to it on either side, 
"Video (2)" and, "QB64 Tutorial -- QBasic for Windows 7 Vista 
Linux -- Free". 

(*) Place your mouse in the blue rectangle. (This works best when 
    the QB64 page occupies your full screen. You may not see all of 
    the pop-up window otherwise.)

You should see a large black rectangle (the play-back area where 
your choice of videos will appear.) To the right of this are two 
Smaller blue rectangles, labelled  "QB64 Tutorial -- QBasic for 
Windows 7 Vista" and "QBasic Tutorial 1 -- Getting Started -- Free".

(*) Place your mouse in your choice of the two small blue rectangles. 
    Be careful that your mouse doesn't pass over the OTHER rectangle 
    when you are trying to select the other video.
 
The selected video (with spoken sounds) should start to play 
automatically. 

(*) I recommend that you listen to BOTH tutorials (they last only 
about five minutes) -- it won't hurt you to know a little bit about 
several slightly different versions of BASIC, running in several 
different environments. The people at School Freeware may even 
explain some things to you even better than I can! 

You may notice that QB64 does not have a "Help" option. Fear not! 
There is a documentation wiki available, which will give you full 
details on all QB64 BASIC keywords. I will explain how to find this 
documentation later, after I have explained how to write a simple 
program. 

One of the BASIC programs talked about in the videos is an 
INTERPRETER -- it has its own separate, special option to make an 
executable file. 

QB64 is a COMPILER -- it only creates executable files. This usually 
takes about a minute before you can run your program, but the 
resulting program will run so much faster! You can run your new 
executable app over and over, and will not need to use QB64 again, 
until you want to change your app or write a new one.

	HOW TO OBTAIN SOME USEFUL RESOURCES

Use your search engine of choice. (I have used Google in a car 
dealership while waiting for car repairs, and Firefox at the 
Caroline County (Maryland) public library; I use Norton Safe 
Search at home. This is a statement of fact, not an endorsement 
for any one of these products.) 

I'm writing these instructions in "baby steps", because I 
understand that Computer Science can be very confusing to 
beginners. Above most other priorities, I want lots of students 
to learn how to write their own apps. This is NOT "The App Store" 
-- this is a free, Do-it-yourself "App FACTORY"!

(1) Search for 
    "Go To _Wikipedia_" seems to be the most useful link. (I put 
    my underscores in front of and behind the words of titles. 
    This helps ME avoid confusion with Internet links. It's also  
    I hope, more legible and easier than underlining the 
    entire title, especially since I use "good old Notepad" as 
    my editor of choice.) 

(2) Click on the word "_Wikipedia_" in the phrase, "Go To 
    _Wikipedia_". It's blue or purple, and underlined, to indicate 
    that this is a link to another Web page. 

    A new page should appear, with the title "Wikipedia", and a 
    picture of a sphere with symbols from various alphabets, 
    surrounded by the names of several different languages. 
    I will be exploring only the "English" Wikipedia. 

(3) Click on the blue word, "English", just above the phrase, 
    "The Free Encyclopedia". 

    Another new page should appear. At the top, it says, 
    "Log in / create account". (You may want to use this later, 
    but perhaps not today -- and not without permission.) Just 
    below this is a rectangle containing the word, "Search", 
    and a picture of a detective's magnifying glass. This 
    rectangle is what we want now. 

(4) Click inside the "Search" rectangle. Type in the characters, 
    "QB64". then click on the picture of the magnifying glass 
    inside the rectangle. 

    This should bring up the page with the title, "QB64", and a 
    picture -- the QB64 logo. This is NOT the QB64 home page, 
    but it's within hailing distance. 

    The bottom line in the medium-sized rectangle containing 
    the picture of the bee, says, 
    "Website http://WWW.QB64.net", (in purple text, followed 
    by a small box with a blue arrow). This is another link.

(5) Click on the purple text, "http://WWW.QB64.net". (This IS 
    the URL for the QB64 home page.) 

    You should see the "bee" logo again, with the caption, 
    "The Official QB64 Website". To the right of the bee is 
    a column of three icons: (A) THe red, green, blue, and 
    yellow Windows icon, (B) a penguin icon, and (C) a silver 
    Apple logo. These emblems correspond to (A) the Windows 
    operating system, (B) the Unix operating system, and (C) 
    Apple's operating system. 

    To the left of the "bee" logo, you should see 
    "Documentation (WIKI)". You will want to use this as a 
    source of reference information, later. It discusses, 
    in detail, most of the things you will need to know to 
    create your own apps, AFTER you have your own free copy 
    of the QB64 BASIC compiler.

	FOR YOUR INFORMATION

    For your information: downloading the file takes about 15 
    minutes. I succeeded in installing the QB64 compiler a 
    few days ago, and am unwilling to risk messing up a 
    situation that appears to be working for me, on my 
    computer. Therefore, I cannot guarantee thgat EVERY DETAIL 
    for the next few steps is absolutely correct (I just do 
    my best.) Besides, if you have different hardware or a  
    different operating system, some details (for you) are 
    certain to be slightly different.

	YOU MAY NEED MORE HELP HERE 
	THAN I (alone, and far away) CAN GIVE YOU

(6) If you have permission (and you may need the help and 
    support of your computer teacher, too) find and click 
    on the purple "Download Details" text which is most 
    suitable for YOUR computer system. 

    You may see a dialog box titled "File Download". "Do you 
    want to save this file, or find a program online to open 
    it?" Your options are, "Find", "Save", and "Cancel". 

    Notice the warning -- this is serious! You need permission, 
    and you may need help. ASK for help if you need it, or 
    click on "Cancel", if you're not sure what to do. 

    "While files from the Internet can be useful, some files 
    can potentially harm your computer. If you do not trust 
    the source, do not find a program to open this file or 
    save this file." 

    "What's the risk?" links to a list of "Frequently Asked 
    Questions" (FAQ's) titled, "Downloading files from the 
    Internet: frequently asked questions".

(7) If you have successfully downloaded the compiler program, 
    you will need to find it. 

    Perhaps this advice will help: 

    "Where are downloaded files saved?"

    "When you download files, Windows usually saves them in 
    the Downloads folder, which is located under your user 
    name in the Users folder on the drive where Windows is 
    installed (for example C:\users\your name\downloads). 
    When you are saving the file, you can choose to save it 
    to a different folder. Some different types of files are 
    saved to different folders by default. For example, if 
    you right-click a picture on a webpage and then choose 
    Save Picture As from the menu, the picture will be saved 
    to the Pictures folder by default. If you're not sure 
    where the file was saved, you can search for it from the 
    Start menu."

    The above text is the advice I got from my windows 7 
    system. Since your system is almost certainly NOT exactly 
    like mine, you will need to learn to be flexible!

    I found a file named "qb64v0942-win", of type "Compressed 
    (zipped) folder", and put in in a new folder I named, 
    "QB64Folder".

(8) Double click on the downloaded file. It should open up 
    into everything (every file) you need to compile your 
    own apps. 

    I found three folders: "internal", "samples", and 
    "source", plus a number of ".dll" files, (which are 
    support files for running QB64 and the apps it creates,) 
    and the "qb64" application itself. 

	A NOTE

I was very pleased to find an elementary tutorial by 
Ted Felix. It looks like a great introduction! Unfortunately, 
he seems to be using a slightly older operating system, and 
possibly an earlier version of BASIC, too. 

Consequently, you will find that some things may not work 
EXACTLY the ways he describes, especially in the first few 
chapters. You will need to be adaptible! 

	STOPPING AN OUT-OF-CONTROL PROGRAM

This stuff is IMPORTANT TO KNOW before you start writing 
programs which can loop forever and never end (without your 
help).

My laptop does not have a "Break" key! I need to do the following 
steps to stop a program caught in an endless loop, or otherwise 
"out of control": 

(A) Hold down these three keys, all at the same 
time -- "CTRL", "ALT", and "DEL".

These messages (from the Windows 7 operating system) should fill 
the display screen:

--> Lock this computer 

--> Switch User

--> Log off

--> Change a password...

--> Start Task Manager

	WHAT TO DO

(B) Select "Task Manager" from this list. 

You should see a window containing a list of all of the 
programs which are running. The name of your program should 
be on this list.

(C) Find and select the name of the program which is running 
"out of control".

You should see a window intended to verify the action of 
closing down a program. It has these options:

(programname) is not responding

Close the program

Wait for the program to respond

(D) Click on "Close the program".

Sometimes, a program leaves a window on the screen after it is 
closed. Most windows have three buttons at the top, some-what 
 ike these: "_", "[]", and "X". If this happens, ...

(E) click on the "X" button to close the window.

You should now be able to resume normal operation of your 
computer. But, you have found evidence that there is a serious 
problem (a "bug") in your program. So, before you run your 
(defective) program again, ...

(F) Restart your QB64 compiler.

(G) Reload your program's source code.

(H) Try to find the problem, then try to fix it by editing 
    your source code.

(I) Save your edited source code.

(J) Recompile your program.

(K) Test your program again, until it works properly. If it 
still doen't work properly, you will need to continue "debugging" 
the program -- reoeat the above steps until it does work.

	A SIMPLE COURTESY

Sometimes, your computer's operating system will encounter 
a problem while executing one of your programs. It may present 
you with an error message screen with two buttons: "Send report", 
and "Don't Send". I think, in most situations, it is only 
polite to click the "Don't Send" button, because it's most 
likely that it is a coding error in your program, which is 
causing the problem. 

It is more appropriate to search the User Forum associated with 
your free software -- perhaps someone else has already posted 
a report on a problem similar to yours. And, even if nothing 
similar has been posted there, the User Community will probably 
be more sympathetic, and more knowledgable.

	vvvvv < VERIFY THIS! > vvvvv

	HOW TO CREATE AN APP

(9) Double click on the icon for the "qb64" application. 
    Caution! these is also a "qb64.bas" file, which you probably 
    will never need, but may find interesting someday, after 
    you learn the fundamentals of BASIC programming. 

    You should find yourself in the QB64 Integrated Development 
    Environment (the IDE). 

(10) Click on "New". This should put you into the integrated 
     source code editor.

(11) Type in: PRINT "Hello, World!"

(12) Click on "Save As" then give your new app a new, unique name.

(13) Click on "Run" and "Start". You should see several messages: 

"Creating exe"

"Starting program"

Finally, you should see a window with the text, "Hello, World!" 
displayed in it. This is your program, running! (Or, at least, it ran in a fraction of a second.)

Congratulations! You have just created a new app! 
Look for it in the list of files in your QB64 folder. 
You can click on the icon for your new app to run it again -- 
you don't need to compile it again, unless you make changes 
to the source code. 

	HOW TO FIND THE QB64 DOCUMENTATION 

	< incomplete >

Navigate to "The Official ... "Documentation Wiki" ... 
In the Contents box: "1 Keywords" ... "Keyword Reference - 
Alphabetical" ... "Keyword Reference - By usage" ... 
"Keyword Reference - By usage" will probably be more helpful 
as you begin learning. Once you understand what most of the 
keywords are for, the alphabetical listing is a handy reference.

	HOW TO FIND TED FELIX's TUTORIAL

Just remember that Ted was using slightly older software. 
I hope the material I have written will help you work around 
the differences. Once you get through the first few chapters, 
Ted will be writing mostly about BASIC programming, and the 
differences between different operating systems will not matter 
nearly so much.

	NOW, START LOOKING AT SAMPLE PROGRAMS

The QB64 User Community has provided plenty of these! I will 
review a few simple programs to get you started. After that, 
you are on your own. May you have good success! :-)

The end.