Simple free BASIC interface

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”’ :confused::confused::confused:

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

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.

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

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).

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

According to this 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.

It doesn’t have a pause key

Also you can remap your laptop keys using sharpkeys

http://www.randyrants.com/2008/12/sharpkeys_30.html

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

You can download old, old versions of Basic, like GW-BASIC, for free. If you follow the links from the wikipedia page 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.

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?

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

Ideally, you don’t. It’s considered bad programming style. Instead you use loops like


DO
   blah blah blah
LOOP UNTIL blah blah

But

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



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

    END


Danke.

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

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.
http://www.petesqbsite.com/sections/express/issue13/fbtc1.html

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

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