QBasic programs by David Fifield, written 1996-1999. Packaged January 2009. These programs are in the public domain now, no matter what they say inside. Most of the programs compile with FreeBASIC. See the included makefile. I tried to modify these as little as possible to make them run on a current computer with FreeBASIC. Some minor syntax changes were necessary. Some features of QBasic are not supported: PLAY and SOUND. Calling CHAIN on a .bas file doesn't work so I changed those into subroutine calls. Many programs ran way too fast so I patched in a delay subroutine. I had to take out some calls to OUT. These files are kept in a Bazaar repository. To see the original, unmodified files as I found them, do bzr get http://www.bamsoftware.com/bzr/qbasic and go back to revision 1. Only a few programs don't work at all: caller.bas relies on a special COM port to control a modem, fontmake.bas and ramismak.bas use machine code to initialize a mouse, and haze.bas and sound.bas don't do anything other than play sound. The menus and everything in bamnit.bas work but you can't actually connect to the modem. TODO * Restore PLAY and SOUND statements to spaceman.bas and virus.bas if they become supported by FreeBASIC.. * Port the mouse code in fontmake.bas and ramismak.bas to something supported by FreeBASIC. Summary of programs == Fractal.bas Generates a Mandelbrot fractal and saves it to a bitmap. == ant2.bas Draws several Langton's ants, written before I knew what they were called. This one grew out of a calculator program. On the calculator the graphics were so slow it took a long time for the ant to build its first highway. == bamnit.bas Bamn It! A program that transmits a file over a telephone modem. I can't remember if it worked; I would be impressed if it did. I took the menu subroutine from a program called BASTerm.BAS by Mark Kim, whose web site was once http://members.aol.com/markkkim but now appears to be http://markuskimi.us/. It is a trivial subroutine but there was a time when I didn't have a concept of a function returning a value; it was mystical to me. I think the file sending code is based on that of a program called "Little Bastard" Modem WarFare (MWARFARE.BAS) by Molnar \ Kucalaba Productions, whose web site was once http://members.aol.com/blood225 but now appears to be http://mk-home.com/. At least that's what one variable name sflag suggests; I do remember reading the code and not knowing what using a variable as a "flag" meant. == bamstart.bas An animated intro for BAM Software. I think I once planned on running the animation at the start of all of our programs. The code was translated from a TI-82 program with the same effects. == bmper.bas Takes what is on the screen and writes it to a bitmap file. This used to be called via a CHAIN statement in other programs. I changed it into a subroutine to work with FreeBASIC. I think reading and writing bitmaps was one of my first experiences working with binary files. In my first tries at displaying an image, it was upside down because the rows are stored in the order opposite to what I expected. I discovered byte endianness before I knew what it was called when my pictures wouldn't display. == boom.bas Models an explosion of hundreds of colored pixels. I must have written this after I learned about data structures (TYPE Dot), because previously I would have managed it with parallel arrays. The velocity variables are declared as integers, so there are only a few discrete initial horizontal velocities. This causes the pixels to sort themselves into visible bins after the explosion has progressed a bit. I remember this program being noticeably slow back when I wrote it, but I had to go back and add a delay to make it watchable on a newer computer. == bootcamp.bas This is just a menu subroutine designed to emulate the one on the TI-82. I wrote it for my friend Hyun Gu Lee so that he could port his BOOTCAMP menu-adventure game from the TI-82 to QBasic. == box.bas An experiment with subpixel rendering. The arrow keys move the box. Its edge pixels are colored shades of gray depending on how much of the pixel the box notionally occupies. == caller.bas A modem dialer. == col.bas A color displayer. Hit the left and right arrow keys to see all the colors. The comments at the bottom refer to colors for ramismak.bas. == dude.bas A picture made with my QBasic Graphics Maker (graphics.bas). == fire.bas This is a little demo of a "going up in smoke" effect. == firework.bas A fireworks physics demo. Press enter to clear the screen or + to save a bitmap (uses the same code as bmper.bas). == fonter.bas This is a test program for the fonts made by fontmake.bas. It displays the contents of a file using a custom font. I think this was inspired by a program called FONTLOAD.BAS by Ken Rockot, whose web site used to be http://users.aol.com/Insane7773. This code is more economical in that it stores one pixel per bit in the font file, not one pixel per byte. == fontmake.bas A font creation program. You painstakingly draw each character of the font with the mouse. The font is saved to a file and can be displayed using the code in fonter.bas. == fractpix.bas Another experiment with subpixel rendering. Two progress bars fill up; one aliased and one antialiased. After that aliased and antialiased columns move across the screen. I think the file name is short for "fractional pixel." == golf.bas I'm not sure, but I think this was a test of intersecting two line segments, as part of the physics of a golf game. == grapher.bas Draws a graph of one or more functions (yv(1).equ and so on) and saves it to a bitmap. I used this program to generate a graph for a report in middle or high school. The teacher asked what program I had used; he was impressed when I said I wrote it myself. == graphics.bas An image editor. When I was experimenting with game programming I wanted a way to draw graphics that was easier than typing the commands to draw points and lines. However I didn't know how to load bitmapped graphics. This program lets you draw images using several paint tools. Its output is executable QBasic code that you just paste in your program. For example, the spraypaint tool colors random pixels within some distance of the cursor; for every pixel it draws it writes a PSET statement to the output file. dude.bas was made with this program. I couldn't find any better examples. When the program starts it prompts you for a drive and a file name. On Unix you can use something like "a" and "image" to write to the file "A:IMAGE.BAS" in the current directory. Next you must choose the variable names for the X and Y reference points around which the image will be drawn. So if in your program the player's location is stored in the variables playerx and playery, enter "playerx, playery" and those variable names will be used in the output file. You must then set the initial values of the centerx and centery variables. Use the 2, 4, 6, and 8 to move the cursor and hit 5 when you are over where you want the picture to begin. Drawing tools. The current tool is indicated by an icon in the lower left corner. 0: Change color. space: Draw a pixel at the cursor. e: Copy a rectangle with GET. Use the spacebar to mark the two corners of the rectangle, then type in its name. d: Paste the most recent copied rectangle. Use the spacebar to place it. r: Add a REM comment in the output file. c: Draw a circle. Use the spacebar to mark its center and a point on its circumference. l: Draw a line segment. Use the spacebar to mark the two endpoints. p: Paint bucket fill at the cursor. q: Pen drawing mode. Use q again to go back to normal mode. s: Spraypaint: use the spacebar to draw a random number of pixels near the cursor. g: Turn on and off grid points. Doesn't affect the output file. x: Exit. == haze.bas An attempt to figure out the melody of "Purple Haze," from when I was trying to arrange the song for my high school orchestra. I guess QBasic was the best music arrangement program I had. == pong.bas A graphics demo something like a 3-D game of pong. A circle bounces around inside a room. Press t to toggle tracking lines. == quadrati.c A quadratic formula program, ported directly from the TI-82. It's not a C program; the strange file name is I think an artifact of QBasic's naming algorithm--anything past the eighth character just became the extension. == ramismak.bas Red Alert Mission Maker, my QBasic magnum opus. This is an interactive mission editor for the game Command & Conquer: Red Alert. It lets you place units and buildings and I don't remember what all else. It really worked! I made a map with a big grid of Mammoth Tanks that made the game lag when you got near enough to wake them up. The burnPRINT subroutine is the only part I'm aware of that's not my own code. I found it again in a web search; it says it's by Angelo Pesce (ftp://ftp.pbhq.de/pgrbasic/burntext.bas). == scribble.fnt This is a font made by me with fontmake.bas. == sound.bas Plays different simple ratio multiples of a base frequency. I must have written it after learning a little bit about just intonation in high school. == spaceman.bas A great action game ported from the TI-82. The mission description: "You are a pilot for the Space Division of the United States Marine Corps. Your mission is to escort a transport to the next station. If you meet any hostile ships, open fire." You have to blast enemy ships with a laser before they crash into you until a timer expires. This is a direct port from the TI-82, leading to a GOTO-based program flow. If you select option 5 at the main menu you can set your callsign and get personalized messages when you score enough kills. == stars.bas An animated starfield. == virus.bas A phony computer virus that pretends to erase all your files. This came from a TI-82 program as well.