Over the years I have had various reasons for writing little programs in Basic. Initially I used GWBasic as that's what I had, but with the advent of MSDOS 6 this was upgraded to QBasic! The two are rather similar, but QBasic has a more user-friendly interface and has a number of additional commands. Also, GW-Basic uses line numbers whereas QBasic uses more structured "modules." I have also included a few of my brother's programs — he is a qualified computer scientist, unlike myself. Most of these don't do anything very useful, but I hope you have some fun!
Special note regarding Windows XP etc.: MS-DOS is now well and truly dead as an operating system. The Windows 95 family still ran on DOS, but meanwhile Microsoft was developing Windows NT (that's New Technology, by the way) and its successors notably Windows XP, in which DOS programs are run using an emulator. Unfortunately this is not perfect; in particular some of the time-critical programs such as Wheels and Nibbles may not run smoothly. Performance is better if programs are run in full-screen mode, rather than in a Window. I have no solutions to this – other than find a PC with DOS still on board! Maybe better DOS emulators do exist, for Linux perhaps – if anyone knows please drop me an email (robert @ londonbusroutes.net - remove the spaces!).
Worse – it seems that the 64-bit version of Windows 7 will not run QBasic at all.
QBasic has been replaced by Visual Basic, which for a time was a paid-for product but is now free again from MS. However inevitably, in being Windows compatible, graphics are much more complex which reduces the ability to do "fun" programs such as these. I do make extensive use of VBA in Excel for the London Bus Routes part of the site, and other things, but have nothing suitable for publication here.
The Beginners All-purpose Symbolic Instruction Code
I have used two versions of the BASIC interpreter for MS-DOS:
The older version is GWBasic (Zipped version). To open a program type LOAD"(full DOS path and filename.GWB)" . Type RUN to run a program, and SYSTEM to get out of GWBasic.
If QBasic is not already installed on your hard disk it should be on the Windows CD, although I am not sure if Microsoft still ship it with the latest versions of Windows. If you haven't got it, and can't get it, let me know. When you run QBasic, ignore any "parameters" box that appears first. QBasic works much like any Windows program: for example you type Alt, F, X to get out.
Don't forget that this software is copyright! (My programs are not, however: be free to distribute them as you like.)
To run any of the programs you will probably need to download them onto your computer first. Note that programs cannot be interchanged - QBasic programs will only run in QBasic and have a .BAS extension, and GWBasic programs only run in GWBasic and have a .GWB extension. A lot of programs can be halted simply by pressing enter at the command prompt, or press CTRL+BREAK if all else fails.
Useful programs
Examine: This program enables you to look at any files. The hexadecimal codes for each byte are shown in the main table, with the characters they represent (if they are meant to represent anything, that is) on the right (green letters represent control characters). Thus for text-based files the right window is of interest, while for binary files the left pane is what you want. (This is one of my brother's programs.) Available in two versions: the original Examine (for GW-Basic: when starting GWBasic it is essential that you include the following switch in the command line: /s:256 after the filename) or ViewFile (recently upgraded to QBasic: this illustrates how much easier it is to understand the code in QBasic).
Ascii code converter Type any key or key combination into the keyboard and out comes the ascii code or keyboard scan code you need to use in programs.
School timetable editor Fine if you have 7 periods a day ...
Nibbles Much improved version of Microsoft's game with extra levels, scoring altered to reflect skill level etc., a score table – and a few bugs ironed out. (Now upgraded to version 2.1.1)
Password A serious, simple but pretty robust, security program for DOS, designed to be included in the computer's startup routine (AUTOEXEC.BAT). Make sure you know the password before running or your computer will lock!!! (LOLLIPOP). Unfortunately it can be bypassed by stepping through the startup routine — if you know how to do that! – and of course NT series Windows do not normally use Autoexec.bat ...
Wave displayer "Examines" a file in a rather unusual way — try it on an 8-bit wave file and see the results. You need to type the file name into the program itself before running it.
Music typesetting program Click the link as it is in several parts.
Graphics
Wheels A pair of interlocking cogwheels – my brother’s computer science coursework from the 1980s.
Graph I told you I like maths ...
House Was this my first Basic program?
Kerb Was this my second Basic program?
Patterns Design a knitting pattern or something ...
Treasure ?!?
Maths
Divisors Give the program a number and it will find all its divisors and add them and give you a new number. Then it does the same for the new number; continuing, this gives you a sequence. Usually the sequence goes to 1 eventually, but not always ...
Bifurcation diagram Suggest you try 3.00. This is all to do with "chaos theory" — the same stuff that gives you things like Julia and Mandelbrot sets.
Percolation This time from complexity theory, a close relative of chaos. This one is most fascinating and would make an excellent screen saver. Dots are placed with probability p, then coloured in in clusters. I suggest you try percolation densities p around 0.58, the so-called “critical density” at which finite clusters of all sizes appear. (For lower values there will only be "small" clusters, for larger values there will be one infinite cluster.)
Music
Beethoven Extract from his (8th) Sonata Pathétique.
BASIC Harmony – didn't think you could get proper music out of the PC Speaker? Well, no, but the following technique is one way round the problem ... Greensleeves, There is a Name, Let us Crown Him, All Things Bright and Beautiful (traditional tune), Ding Dong Merrily on High. I have 300 of these altogether!
Gimmicks
Return to
Characters Display the full MS-DOS character set — i.e. including the special "control" characters.
Cheese Make of this what you will — I'm not sure what it was meant to be!
Computer speed comparer of a rather unlikely design ... yes that's what I originally wrote it for...
Noise Test the capability of your computer's internal speaker (and drive the neighbours mad).
Screen flicker Originally this displayed the 64 colours at a nice pace — but with a "fast" computer it runs too fast. Hence the name change ...
My homepage