# Simple free BASIC interface

**URL:** <https://boards.straightdope.com/t/simple-free-basic-interface/490665>\
**Category:** Factual Questions\
**Created:** [March 24, 2009, 11:56pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665 "2009-03-24T23:56:58Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![Mr\_Shine](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mr_shine/32/464_2.png) [@Mr\_Shine](https://boards.straightdope.com/u/Mr_Shine)\
**Post date:** [March 25, 2009, 11:24am UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/21 "2009-03-25T11:24:03Z")

</div>

> [@OOPSIE](#):
>
> Redownload and install Freebasic
> 
> Then from the same website, download and install FBIDE
> 
> Run FBIDE. Tell FBIDE where Freebasic is installed  
> Now go to “File” then click “New”
> 
> Type this
> 
> while inkey$=“”  
> print “Hello World”  
> wend
> 
> Then press F9
> 
> Save the file somewhere, and enjoy

OK, downloaded and run both programs. Before doing anything useful I tried to make sure it worked by putting in the Granddaddy of simple programs.

10 Print “hello”  
20 goto 10

I got an error message:

"Only valid in -lang deprecated or fblite or qb in ‘10 print “hello”’ 😕😕😕

The “help” was completely useless in determining what the hell was wrong.

---

<div class="post-metadata">

**Author:** ![Crowbar\_of\_Irony\_3](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@Crowbar\_of\_Irony\_3](https://boards.straightdope.com/u/Crowbar_of_Irony_3)\
**Post date:** [March 25, 2009, 11:44am UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/22 "2009-03-25T11:44:14Z")

</div>

FreeBasic uses QBasic’s style strictly — no line numbers.

There’s a way to turn on deprecated features, but you need to dig through the documentation. Just remove the line numbers and give it a try.

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [March 25, 2009, 11:51am UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/23 "2009-03-25T11:51:42Z")

</div>

> [@Mr\_Shine](#):
>
> 20 goto 10

I guess when you say you don’t want to learn anything new, you really mean it 😃  
Line numbers? GOTO?? That’s old school, even by BASIC standards.

---

<div class="post-metadata">

**Author:** ![RitterSport](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/rittersport/32/6326_2.png) [@RitterSport](https://boards.straightdope.com/u/RitterSport)\
**Post date:** [March 25, 2009, 12:26pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/24 "2009-03-25T12:26:59Z")

</div>

> [@Mr\_Shine](#):
>
> OK, downloaded and run both programs. Before doing anything useful I tried to make sure it worked by putting in the Granddaddy of simple programs.
> 
> 10 Print “hello”  
> 20 goto 10
> 
> I got an error message:
> 
> "Only valid in -lang deprecated or fblite or qb in ‘10 print “hello”’ 😕😕😕
> 
> The “help” was completely useless in determining what the hell was wrong.

Really, I think you should go with AppleWin. Applesoft Basic was just like this above. Install AppleWin, press on the disk drive icon and put in a “Master Disk” – comes with the install, I believe. Press the apple button to “boot up” the machine. You’ll see a ] prompt. Type in the program above and it would work fine. To run it, type RUN. To break it, use ctrl-C.

If you write a program and want to save it, you should be able to type SAVE \<program name\> and it should end up on the Master Disk for the next time you load it up. To load it, type LOAD \<program name\> or RUN \<program name\> (you don’t use the greater or less than signs, of course).

---

<div class="post-metadata">

**Author:** ![Bewildebeest](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@Bewildebeest](https://boards.straightdope.com/u/Bewildebeest)\
**Post date:** [March 25, 2009, 1:39pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/25 "2009-03-25T13:39:56Z")

</div>

On my ancient Dell Inspiron, ctrl-fn-pause does a ctrl-break.

---

<div class="post-metadata">

**Author:** ![HorseloverFat](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@HorseloverFat](https://boards.straightdope.com/u/HorseloverFat)\
**Post date:** [March 25, 2009, 1:47pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/26 "2009-03-25T13:47:34Z")

</div>

[According to this](http://qbasic-forum.qbcafe.net/viewtopic.php?t=565) you can hit control+break and then the esc key to stop programs if control+break isnt working. Also they list inserting logic to make the program easy to stop.

You can also write a macro with AutoIT/AutoHotKey to press those buttons for you.

---

<div class="post-metadata">

**Author:** ![Mr\_Shine](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mr_shine/32/464_2.png) [@Mr\_Shine](https://boards.straightdope.com/u/Mr_Shine)\
**Post date:** [March 25, 2009, 2:03pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/27 "2009-03-25T14:03:16Z")

</div>

> [@Bewildebeest](#):
>
> On my ancient Dell Inspiron, ctrl-fn-pause does a ctrl-break.

It doesn’t have a pause key

---

<div class="post-metadata">

**Author:** ![HorseloverFat](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@HorseloverFat](https://boards.straightdope.com/u/HorseloverFat)\
**Post date:** [March 25, 2009, 2:27pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/28 "2009-03-25T14:27:49Z")

</div>

Also you can remap your laptop keys using sharpkeys

[http://www.randyrants.com/2008/12/sharpkeys\_30.html](http://www.randyrants.com/2008/12/sharpkeys_30.html)

---

<div class="post-metadata">

**Author:** ![Mr\_Shine](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mr_shine/32/464_2.png) [@Mr\_Shine](https://boards.straightdope.com/u/Mr_Shine)\
**Post date:** [March 25, 2009, 2:28pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/29 "2009-03-25T14:28:42Z")

</div>

> [@CrazyChop](#):
>
> FreeBasic uses QBasic’s style strictly — no line numbers.
> 
> There’s a way to turn on deprecated features, but you need to dig through the documentation. Just remove the line numbers and give it a try.

OK, thanks. Seems to be working. How do I get the dos window to stay on screen when the program ends?

---

<div class="post-metadata">

**Author:** ![anson2995](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@anson2995](https://boards.straightdope.com/u/anson2995)\
**Post date:** [March 25, 2009, 2:36pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/30 "2009-03-25T14:36:56Z")

</div>

You can download old, old versions of Basic, like [GW-BASIC](http://www.geocities.com/KindlyRat/GWBASIC.html), for free. If you follow the links from the [wikipedia page](http://en.wikipedia.org/wiki/BASIC) on BASIC (ie QBasic, etc.), you’ll find download links for many of these old flavors of BASIC.

QBasic had a compiler and had support for structures, both of which were a big step forward at the time (~1990), and frankly if you’re writing programs with line numbers and goto statements, that may be too much for you. (Not trying to be condescending, just trying to give you the answer you’re looking for.) The IDE for things like Visual Basic and FreeBasic are going to be foreign to you, as will many of the fundamental concepts they promote, like object oriented programming.

I recomend GW-BASIC, which was developed by Bill Gates and included with MS DOS releases from ~1983-88.

---

<div class="post-metadata">

**Author:** ![Really\_Not\_All\_That\_Bright](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Really\_Not\_All\_That\_Bright](https://boards.straightdope.com/u/Really_Not_All_That_Bright)\
**Post date:** [March 25, 2009, 2:38pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/31 "2009-03-25T14:38:19Z")

</div>

> [@Ximenean](#):
>
> Line numbers? GOTO?? That’s old school, even by BASIC standards.

Really, really old-school BASIC programmer here (so old school the last thing I wrote a program for was [this](http://en.wikipedia.org/wiki/BBC_Micro))… how do you tell it to return to a line if there are no line numbers?

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [March 25, 2009, 2:47pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/32 "2009-03-25T14:47:46Z")

</div>

> [@anson2995](#):
>
> QBasic had a compiler

Are you sure about that? I thought QBasic was strictly an interpreter, while QuickBasic was the compiled version.

[QUOTE=Really Not All That Bright]  
Really, really old-school BASIC programmer here (so old school the last thing I wrote a program for was this)… how do you tell it to return to a line if there are no line numbers?  
[/QUOTE]  
Ideally, you don’t. [It’s considered bad programming style.](http://en.wikipedia.org/wiki/Goto#Criticism_of_goto_usage) Instead you use loops like

```auto

DO
   blah blah blah
LOOP UNTIL blah blah

```

But  
[QUOTE=Wikipedia article on QBasic]  
Line numbers, a concept often associated with BASIC, are supported for compatibility, but are not considered good form, having been replaced by descriptive line labels.  
[/QUOTE]

---

<div class="post-metadata">

**Author:** ![Q.E.D](https://avatars.discourse-cdn.com/v4/letter/q/51bf81/32.png) [@Q.E.D](https://boards.straightdope.com/u/Q.E.D)\
**Post date:** [March 25, 2009, 2:59pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/33 "2009-03-25T14:59:53Z")

</div>

> [@Really\_Not\_All\_That\_Bright](#):
>
> Really, really old-school BASIC programmer here (so old school the last thing I wrote a program for was [this](http://en.wikipedia.org/wiki/BBC_Micro))… how do you tell it to return to a line if there are no line numbers?

Specifically, as noted above, you’d write something like:

```auto

     X = 0
Loop:
    X = X + 1
    IF X > 42 THEN GOTO LOOP

    END

```

---

<div class="post-metadata">

**Author:** ![Really\_Not\_All\_That\_Bright](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Really\_Not\_All\_That\_Bright](https://boards.straightdope.com/u/Really_Not_All_That_Bright)\
**Post date:** [March 25, 2009, 3:03pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/34 "2009-03-25T15:03:16Z")

</div>

Danke.

---

<div class="post-metadata">

**Author:** ![OOPSIE](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@OOPSIE](https://boards.straightdope.com/u/OOPSIE)\
**Post date:** [March 25, 2009, 4:16pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/35 "2009-03-25T16:16:09Z")

</div>

> [@Mr\_Shine](#):
>
> OK, downloaded and run both programs. Before doing anything useful I tried to make sure it worked by putting in the Granddaddy of simple programs.
> 
> 10 Print “hello”  
> 20 goto 10
> 
> I got an error message:
> 
> "Only valid in -lang deprecated or fblite or qb in ‘10 print “hello”’ 😕😕😕
> 
> The “help” was completely useless in determining what the hell was wrong.

If you really REALLY want to program in a horribly old fashioned way (Which I wouldn’t recommend but I’m not gonna tell you what to do) then put this at the beginning of your programme

#lang “fblite”

That will allow you to use old fashioned basic. For example

#lang “fblite”  
10 print “boo”  
20 goto 10

---

<div class="post-metadata">

**Author:** ![Crowbar\_of\_Irony\_3](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@Crowbar\_of\_Irony\_3](https://boards.straightdope.com/u/Crowbar_of_Irony_3)\
**Post date:** [March 25, 2009, 4:36pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/36 "2009-03-25T16:36:57Z")

</div>

> [@Mr\_Shine](#):
>
> OK, thanks. Seems to be working. How do I get the dos window to stay on screen when the program ends?

Ehhh use the $INKEY trick.  
(It has been decades. I forgot what it is)

On Edit: Think there’s a command called SLEEP.

Here’s a quick tutorial.

> **[A Course in FreeBasic: Chapter 1](http://www.petesqbsite.com/sections/express/issue13/fbtc1.html)**

---

<div class="post-metadata">

**Author:** ![Crowbar\_of\_Irony\_3](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@Crowbar\_of\_Irony\_3](https://boards.straightdope.com/u/Crowbar_of_Irony_3)\
**Post date:** [March 25, 2009, 4:38pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/37 "2009-03-25T16:38:04Z")

</div>

> [@Really\_Not\_All\_That\_Bright](#):
>
> Really, really old-school BASIC programmer here (so old school the last thing I wrote a program for was [this](http://en.wikipedia.org/wiki/BBC_Micro))… how do you tell it to return to a line if there are no line numbers?

QBasic support named functions and named subroutines, so basically you can write a structured program pretty much like C (just without a main() )

---

<div class="post-metadata">

**Author:** ![OOPSIE](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@OOPSIE](https://boards.straightdope.com/u/OOPSIE)\
**Post date:** [March 25, 2009, 4:41pm UTC](https://boards.straightdope.com/t/simple-free-basic-interface/490665/38 "2009-03-25T16:41:13Z")

</div>

> [@CrazyChop](#):
>
> Ehhh use the $INKEY trick.  
> (It has been decades. I forgot what it is)

Well, if you don’t want your programme to exit, then don’t let it exit.

10 Start of programme…  
20 blah  
30 blah  
40 blah

…

200 blah  
210 end of programme  
220 goto 220

Then your programme will never exit

Or, if you want it to only exit on a keypress, you can do something like this

220 if inkey$=“” then goto 220

That will prevent the program from exiting till a key is pressed. You can make sure there are no keypresses in the keybuffer first like this if you want

220 if inkey$\<\>“” then goto 220  
230 if inkey$=“” then goto 230.

With 230 being the end of your programme

Line 220 will just make sure the keybuffer is empty, so if you touched a key sometime during the programme, it wont cause line 230 to immedately make you exit

[Previous page](https://boards.straightdope.com/t/simple-free-basic-interface/490665.md?page=1)
