Stupid DOS tricks. (MS-DOS Featuring DOS 5.0)
by Mark Minasi
All work and no play--that's what they say, right? (I'm not sure it's true, but they say it, anyway.) Nothing like a little cybernetic razzle-dazzle or some silicon. tomfoolery to show them the error of their ways.
What? You didn't think there were any PC practical jokes? Well, there are lots of 'em. I think the first I ever saw was the famous DRAIN.COM program. Once run on an unsuspecting user's system, the DRAIN program presented a harmless-looking C: prompt. But as soon as you typed a key, you got a message that said System error: water detected in drive A:. Then it ran the floppy for a while, all the time mimicking, quite well, the sound of water flowing down a drain. It then set the floppy on "spin dry," finally pronouncing it usable for service. This little item isn't a malicious practical joke, but rather a bit of a special effect.
If you've never looked at the things you can do with the ANSI.SYS commands, consider this: They can do such things as move the cursor or swap key definitions around. The following QBASIC program will create a file called FWORKS. Once the program runs, just enter TYPE FWORKS, and you'll see a star explode on your screen, followed by the words Good Morning. Put it in your AUTOEXEC.BAT--or someone else's--and the morning bootup will be a bit less dull.
X Marks the Spot
A few notes on the program. What it does is place a ring of Xs on the screen, wait a little while, erase then, place another ring of Xs outside the last ring, erase them, and so on. It's all built on a single ANSI.SYS command, the place cursor command: ESC[y;xH, where ESC is the Escape code (ASCII 27), and x and y are the x,y coordinates where you want to place the cursor. For example, to place the cursor at x=40 and y=12, roughly the center of the screen, send ESC[12;40H to the screen.
The program assembles all of the necessary commands into the file FWORKS, and all you need to do is TYPE the file to send it to the screen. By the way, ANSI.SYS must be present in your CONFIG.SYS for this to work.
This program ran much too fast on my computer, so I inserted a delay loop by making the program display a blank in the lower left corner of the screen 30 times. You may need to make the value larger or smaller to produce the desired effect on your system.
The DX and DY variables dictate the direction in which the Xs go. Play with them, and you can make them soar off in different directions. Or use the change-screen-attributes command ESC[...m to make the Xs change color as they go. The current program changes the color of the Xs according to the direction they're moving. Try several stars exploding at different points on the screen. Or a snaking path of Xs spiraling out from the center.
'This is a QBASIC program to generate an ANSI.SYS file that can be TYPEd to 'the screen. DEF fna$ (x) = MID$(STR$(x), 2) DIM x(8), y(8), dx(8), dy(8), lx(8), ly(8) DATA 1,0,1,1,0,1,-1,1,-1,0,-1,-1,0,-1,1,-1 FOR i = 1 TO 8: READ dx(i), dy(i): NEXT FOR i = 1 to 8: x(i) = 40: y(i) = 12: NEXT FOR i = 1 TO 8: lx(1) = x(i): NEXT FOR i = 1 TO 8: ly(i) = y(i): NEXT OPEN "fworks" FOR OUTPUT AS 1 e$ = CHR$(27) + "[" REM clear screen PRINT #1, e$; "2J" FOR x = 0 TO 10' do 11 iterations FOR i = 1 TO 8 x(i) = x(i) + dx(i) y(i) = y(i) + dy(i) lx(i) = x(i) ly(i) = y(i) 'set color print #1,E$;fna$(31+i);"m"; ' place X PRINT #1, e$; fna$(y(i)); ";"; fna$(x(i)); "H"; "X"; NEXT i 'produce a delay FOR i = 1 TO 30 PRINT #1, e$; "22;1H" NEXT 'erase last line FOR i = 1 TO 8 ' first position cursor y,x PRINT #1, e$; fna$(ly(i)); ";"; fna$(lx(i)); "H"; " "; NEXT i NEXT PRINT #1, e$; "12;32HGood Morning!" CLOSE