brianjn
2011-12-26 21:52:40 |
QBasic/QuickBASIC
I have a laptop running under a Win7 64-bit OS.
This means that some programs which I like cannot be run on it.
QuickBASIC/QBasic, whatever came out with MS-DOS 5 & 6. Until Win7 I could use it, but now ....
Well, not until now that I have discovered "dosbox" this is an x86 emulator with DOS. Find it at dosbox.com.
I merely had to install the emulator and have it point to the directory which housed my QBasic files. There are a few 'tricks' which are explained in documentation, but generally it is straightforward.
I did come across something just a little different a few days before writing. There is a QB64 project in progress. It uses almost all of the commands of the old QBasic but has some additions. They are explained at the site, qb64.net.
Again at the time of writing the program does not have an in-built help file. I have the understanding that will be included in a new release but for the moment use the Offline Help package, a RAR file for download, http://www.qb64.net/wiki until then. |
brianjn
2011-12-29 06:54:06 |
Re: QBasic/QuickBASIC
There are two things I should point out here, and are of considerable importance.
1. The Project team have installed 'audit' system such that coding entries are monitored an the bottom of the screen and so offering 'prompts'. Should there be some perceived error (like you entered a FOR loop and have not yet entered the necessary body statements you get a red bar to indicate that you need a NEXT!)
2. In the MS-DOS 5 & 6 versions one simply ran a text interpreted program. Here the Project Team takes this to a different level.
When the listing is RUN the program seems to hesitate. In this phase the text is converted, or rather compiled, into a C++ exe file and then run. Since the interpreter is bypassed the program runs at the machine level which is obvious faster.
|
brianjn
2011-12-29 22:53:54 |
QB - Primes
This segment is a rewrite from a partial javascript routine:
DO
IF (a MOD i = 0) THEN prm = 1
i = i + 1
LOOP WHILE (i < a AND prm = 0)
The IF statement provides the \"trap\" and the LOOP statement sets limits on testing.
This listing prints all the odd primes below 9999 to the screen and to file in 10 columns (the initial ones are not particularly tidy for numerals below 1000).
OPEN \"prime.txt\" FOR OUTPUT AS #1
ln = 0
FOR a = 3 TO 9999
prm = 0
i = 2
IF (a MOD i = 0) THEN prm = 1
i = i + 1
LOOP WHILE (i < a AND prm = 0)
IF prm = 0 THEN
PRINT a;
PRINT #1, a;
ln = ln + 1
END IF
IF ln = 10 THEN
ln = 0
PRINT
PRINT #1,
END IF
NEXT
CLOSE 1 |
brianjn
2011-12-29 22:56:55 |
QB - Primes
Hmm. The diagonal slashes do not belong in the listing above. |
Charlie
2012-01-20 18:23:43 |
Re: QBasic/QuickBASIC
I've just tried a speed comparison of QB4.5 and QB64 (on a Windows XP machine). A program taking 21.6 seconds in QB4.5 took 3.13 seconds in QB64, not counting compile time. |