Introduction

Retro Recovery

Difficulty:
Join Mark in the retro shop. Analyze his disk image for a blast from the retro past and recover some classic treasures.

Mark DeVito is hanging out in the Retro Emporium:

image-20251108170154781
Mark Devito

Mark Devito

I am an avid collector of things of the past. I love old technology. I love how it connects us to the past. Some remind me of my dad, who was an engineer on the Apollo 11 mission and helped develop the rendezvous and altimeter radar on the space craft.

If you ever get into collecting things like vintage computers, here is a tip. Never forget to remove the RIFA capacitors from vintage computer power supplies when restoring a system. If not they can pop and fill the room with nasty smoke.

I love vintage computing, it’s the very core of where and when it all began. I still enjoy writing programs in BASIC and have started re-learning Apple II assembly language. I started writing code in 1982 on a Commodore CBM.

Sometimes it is the people no one can imagine anything of who do the things no one can imagine. - Alan Turing

You never forget your first 8-bit system.

While Kevin and I were cleaning up the Retro Store, we found this FAT12 floppy disk image, must have been under this arcade machine for years. These disks were the heart of machines like the Commodore 64. I am so glad you can still mount them on a modern PC.

When I was a kid we shared warez by hiding things as deleted files.

I remember writing programs in BASIC. So much fun! My favorite was Star Trek.

The beauty of file systems is that ‘deleted’ doesn’t always mean gone forever.

Ready to dive into some digital archaeology and see what secrets this old disk is hiding?

Go to Items in your badge, download the floppy disk image, and see what you can find!

Chat with Mark DeVito

Congratulations! You spoke with Mark DeVito!

There is now a floppy.img in the Items section of my badge:

floppy.img

floppy.img

You got yourself a floppy disk image from an old IBM PC! Retro!!!!

Solution

Simple Solution

On seeing this file, the first thing I did was run strings on it (looking for strings of length 15 or more to get rid of a bunch of junk):

oxdf@hacky$ strings floppy.img -n 15
NO NAME    FAT12
This is not a bootable disk.  Please insert a bootable floppy and
press any key to try again ...
all_i-want_for_christmas.bas
1 REM original file superstartrek.bas dated 2/13/2009 from bcg.tar.gz
2 REM QBasic conversion by WTN...
3 REM 2/16/2021 - uncrunched, changed B9=2 to B9=0, added RANDOMIZE and SLEEP
4 REM incorporated instructions from superstartrekins.bas
5 REM 2/19/2021 - changed the code after DO YOU NEED INSTRUCTIONS?
10 REM SUPER STARTREK - MAY 16,1978 - REQUIRES 24K MEMORY
40 REM ****        **** STAR TREK ****        ****
50 REM **** SIMULATION OF A MISSION OF THE STARSHIP ENTERPRISE,
60 REM **** AS SEEN ON THE STAR TREK TV SHOW.
70 REM **** ORIGIONAL PROGRAM BY MIKE MAYFIELD, MODIFIED VERSION
80 REM **** PUBLISHED IN DEC'S "101 BASIC GAMES", BY DAVE AHL.
90 REM **** MODIFICATIONS TO THE LATTER (PLUS DEBUGGING) BY BOB
100 REM *** LEEDOM - APRIL & DECEMBER 1974,
110 REM *** WITH A LITTLE HELP FROM HIS FRIENDS . . .
120 REM *** COMMENTS, EPITHETS, AND SUGGESTIONS SOLICITED --
130 REM *** SEND TO:  R. C. LEEDOM
140 REM ***           WESTINGHOUSE DEFENSE & ELECTRONICS SYSTEMS CNTR.
150 REM ***           BOX 746, M.S. 338
160 REM ***           BALTIMORE, MD  21203
180 REM *** CONVERTED TO MICROSOFT 8 K BASIC 3/16/78 BY JOHN GORDERS
190 REM *** LINE NUMBERS FROM VERSION STREK7 OF 1/12/75 PRESERVED AS
200 REM *** MUCH AS POSSIBLE WHILE USING MULTIPLE STATEMENTS PER LINE
205 REM *** SOME LINES ARE LONGER THAN 72 CHARACTERS; THIS WAS DONE
210 REM *** BY USING "?" INSTEAD OF "PRINT" WHEN ENTERING LINES
211 REM bWVycnkgY2hyaXN0bWFzIHRvIGFsbCBhbmQgdG8gYWxsIGEgZ29vZCBuaWdodAo=
219 GOSUB 20000:REM instructions
220 PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT
221 PRINT"                                    ,------*------,"
222 PRINT"                    ,-------------   '---  ------'"
223 PRINT"                     '-------- --'      / /"
224 PRINT"                         ,---' '-------/ /--,"
225 PRINT"                          '----------------'":PRINT
226 PRINT"                    THE USS ENTERPRISE --- NCC-1701"
227 PRINT:PRINT:PRINT:PRINT:PRINT
250 RANDOMIZE(TIMER):SLEEP 3
260 REM CLEAR 600
270 Z$="                         "
330 DIM G(8,8),C(9,2),K(3,3),N(3),Z(8,8),D(8)
370 T=INT(RND(1)*20+20)*100:T0=T:T9=25+INT(RND(1)*10):D0=0:E=3000:E0=E
440 P=10:P0=P:S9=200:S=0:B9=0:K9=0:X$="":X0$=" IS "
470 DEF FND(D)=SQR((K(I,1)-S1)^2+(K(I,2)-S2)^2)
475 DEF FNR(R)=INT(RND(R)*7.98+1.01)
480 REM INITIALIZE ENTERPRIZE'S POSITION
490 Q1=FNR(1):Q2=FNR(1):S1=FNR(1):S2=FNR(1)
530 FOR I=1 TO 9:C(I,1)=0:C(I,2)=0:NEXT I
540 C(3,1)=-1:C(2,1)=-1:C(4,1)=-1:C(4,2)=-1:C(5,2)=-1:C(6,2)=-1
600 C(1,2)=1:C(2,2)=1:C(6,1)=1:C(7,1)=1:C(8,1)=1:C(8,2)=1:C(9,2)=1
670 FOR I=1 TO 8:D(I)=0:NEXT I
710 A1$="NAVSRSLRSPHATORSHEDAMCOMXXX"
810 REM SETUP WHAT EXHISTS IN GALAXY . . .
815 REM K3= # KLINGONS  B3= # STARBASES  S3 = # STARS
820 FOR I=1 TO 8:FOR J=1 TO 8:K3=0:Z(I,J)=0:R1=RND(1)
850 IF R1>.98 THEN K3=3:K9=K9+3:GOTO 980
860 IF R1>.95 THEN K3=2:K9=K9+2:GOTO 980
870 IF R1>.80 THEN K3=1:K9=K9+1
980 B3=0:IF RND(1)>.96 THEN B3=1:B9=B9+1
1040 G(I,J)=K3*100+B3*10+FNR(1):NEXT J:NEXT I:IF K9>T9 THEN T9=K9+1
1100 IF B9<>0 THEN 1200
1150 IF G(Q1,Q2)<200 THEN G(Q1,Q2)=G(Q1,Q2)+120:K9=K9+1
1160 B9=1:G(Q1,Q2)=G(Q1,Q2)+10:Q1=FNR(1):Q2=FNR(1)
1200 K7=K9:IF B9<>1 THEN X$="S":X0$=" ARE "
1230 PRINT"YOUR ORDERS ARE AS FOLLOWS:"
1240 PRINT"     DESTROY THE";K9;"KLINGON WARSHIPS WHICH HAVE INVADED"
1252 PRINT"   THE GALAXY BEFORE THEY CAN ATTACK FEDERATION HEADQUARTERS"
1260 PRINT"   ON STARDATE";T0+T9;"  THIS GIVES YOU";T9;"DAYS.  THERE";X0$
1272 PRINT"  ";B9;"STARBASE";X$;" IN THE GALAXY FOR RESUPPLYING YOUR SHIP"
1280 PRINT:REM PRINT"HIT ANY KEY EXCEPT RETURN WHEN READY TO ACCEPT COMMAND"
1300 I=RND(1):REM IF INP(1)=13 THEN 1300
1310 REM HERE ANY TIME NEW QUADRANT ENTERED
1320 Z4=Q1:Z5=Q2:K3=0:B3=0:S3=0:G5=0:D4=.5*RND(1):Z(Q1,Q2)=G(Q1,Q2)
1390 IF Q1<1 OR Q1>8 OR Q2<1 OR Q2>8 THEN 1600
1430 GOSUB 9030:PRINT:IF T0<>T THEN 1490
1460 PRINT"YOUR MISSION BEGINS WITH YOUR STARSHIP LOCATED"
1470 PRINT"IN THE GALACTIC QUADRANT, '";G2$;"'.":GOTO 1500
1490 PRINT"NOW ENTERING ";G2$;" QUADRANT . . ."
1500 PRINT:K3=INT(G(Q1,Q2)*.01):B3=INT(G(Q1,Q2)*.1)-10*K3
1540 S3=G(Q1,Q2)-100*K3-10*B3:IF K3=0 THEN 1590
1560 PRINT"COMBAT AREA      CONDITION RED":IF S>200 THEN 1590
1580 PRINT"   SHIELDS DANGEROUSLY LOW"
1590 FOR I=1 TO 3:K(I,1)=0:K(I,2)=0:NEXT I
1600 FOR I=1 TO 3:K(I,3)=0:NEXT I:Q$=Z$+Z$+Z$+Z$+Z$+Z$+Z$+LEFT$(Z$,17)
1660 REM POSITION ENTERPRISE IN QUADRANT, THEN PLACE "K3" KLINGONS, &
1670 REM "B3" STARBASES, & "S3" STARS ELSEWHERE.
1680 A$="<*>":Z1=S1:Z2=S2:GOSUB 8670:IF K3<1 THEN 1820
1720 FOR I=1 TO K3:GOSUB 8590:A$="+K+":Z1=R1:Z2=R2
1780 GOSUB 8670:K(I,1)=R1:K(I,2)=R2:K(I,3)=S9*(0.5+RND(1)):NEXT I
1820 IF B3<1 THEN 1910
1880 GOSUB 8590:A$=">!<":Z1=R1:B4=R1:Z2=R2:B5=R2:GOSUB 8670
1910 FOR I=1 TO S3:GOSUB 8590:A$=" * ":Z1=R1:Z2=R2:GOSUB 8670:NEXT I
1980 GOSUB 6430
1990 IF S+E>10 THEN IF E>10 OR D(7)=0 THEN 2060
2020 PRINT:PRINT"** FATAL ERROR **   YOU'VE JUST STRANDED YOUR SHIP IN "
2030 PRINT"SPACE":PRINT"YOU HAVE INSUFFICIENT MANEUVERING ENERGY,";
2040 PRINT" AND SHIELD CONTROL":PRINT"IS PRESENTLY INCAPABLE OF CROSS";
2050 PRINT"-CIRCUITING TO ENGINE ROOM!!":GOTO 6220
2060 INPUT"COMMAND";A$
2080 FOR I=1 TO 9:IF LEFT$(A$,3)<>MID$(A1$,3*I-2,3) THEN 2160
2140 ON I GOTO 2300,1980,4000,4260,4700,5530,5690,7290,6270
2160 NEXT I:PRINT"ENTER ONE OF THE FOLLOWING:"
2180 PRINT"  NAV  (TO SET COURSE)"
2190 PRINT"  SRS  (FOR SHORT RANGE SENSOR SCAN)"
2200 PRINT"  LRS  (FOR LONG RANGE SENSOR SCAN)"
2210 PRINT"  PHA  (TO FIRE PHASERS)"
2220 PRINT"  TOR  (TO FIRE PHOTON TORPEDOES)"
2230 PRINT"  SHE  (TO RAISE OR LOWER SHIELDS)"
2240 PRINT"  DAM  (FOR DAMAGE CONTROL REPORTS)"
2250 PRINT"  COM  (TO CALL ON LIBRARY-COMPUTER)"
2260 PRINT"  XXX  (TO RESIGN YOUR COMMAND)":PRINT:GOTO 1990
2290 REM COURSE CONTROL BEGINS HERE
2300 INPUT"COURSE (0-9)";C1:IF C1=9 THEN C1=1
2310 IF C1>=1 AND C1<9 THEN 2350
2330 PRINT"   LT. SULU REPORTS, 'INCORRECT COURSE DATA, SIR!'":GOTO 1990
2350 X$="8":IF D(1)<0 THEN X$="0.2"
2360 PRINT"WARP FACTOR (0-";X$;")";:INPUT W1:IF D(1)<0 AND W1>.2 THEN 2470
2380 IF W1>0 AND W1<=8 THEN 2490
2390 IF W1=0 THEN 1990
2420 PRINT"   CHIEF ENGINEER SCOTT REPORTS 'THE ENGINES WON'T TAKE";
2430 PRINT" WARP ";W1;"!'":GOTO 1990
2470 PRINT"WARP ENGINES ARE DAMAGED.  MAXIUM SPEED = WARP 0.2":GOTO 1990
2490 N=INT(W1*8+.5):IF E-N>=0 THEN 2590
2500 PRINT"ENGINEERING REPORTS   'INSUFFICIENT ENERGY AVAILABLE"
2510 PRINT"                       FOR MANEUVERING AT WARP";W1;"!'"
2530 IF S<N-E OR D(7)<0 THEN 1990
2550 PRINT"DEFLECTOR CONTROL ROOM ACKNOWLEDGES";S;"UNITS OF ENERGY"
2560 PRINT"                         PRESENTLY DEPLOYED TO SHIELDS."
2580 REM KLINGONS MOVE/FIRE ON MOVING STARSHIP . . .
2590 FOR I=1 TO K3:IF K(I,3)=0 THEN 2700
2610 A$="   ":Z1=K(I,1):Z2=K(I,2):GOSUB 8670:GOSUB 8590
2660 K(I,1)=Z1:K(I,2)=Z2:A$="+K+":GOSUB 8670
2700 NEXT I:GOSUB 6000:D1=0:D6=W1:IF W1>=1 THEN D6=1
2770 FOR I=1 TO 8:IF D(I)>=0 THEN 2880
2790 D(I)=D(I)+D6:IF D(I)>-.1 AND D(I)<0 THEN D(I)=-.1:GOTO 2880
2800 IF D(I)<0 THEN 2880
2810 IF D1<>1 THEN D1=1:PRINT"DAMAGE CONTROL REPORT:  ";
2840 PRINT TAB(8);:R1=I:GOSUB 8790:PRINT G2$;" REPAIR COMPLETED."
2880 NEXT I:IF RND(1)>.2 THEN 3070
2910 R1=FNR(1):IF RND(1)>=.6 THEN 3000
2930 D(R1)=D(R1)-(RND(1)*5+1):PRINT"DAMAGE CONTROL REPORT:  ";
2960 GOSUB 8790:PRINT G2$;" DAMAGED":PRINT:GOTO 3070
3000 D(R1)=D(R1)+RND(1)*3+1:PRINT"DAMAGE CONTROL REPORT:  ";
3030 GOSUB 8790:PRINT G2$;" STATE OF REPAIR IMPROVED":PRINT
3060 REM BEGIN MOVING STARSHIP
3070 A$="   ":Z1=INT(S1):Z2=INT(S2):GOSUB 8670
3110 X1=C(C1,1)+(C(C1+1,1)-C(C1,1))*(C1-INT(C1)):X=S1:Y=S2
3140 X2=C(C1,2)+(C(C1+1,2)-C(C1,2))*(C1-INT(C1)):Q4=Q1:Q5=Q2
3170 FOR I=1 TO N:S1=S1+X1:S2=S2+X2:IF S1<1 OR S1>=9 OR S2<1 OR S2>=9 THEN 3500
3240 S8=INT(S1)*24+INT(S2)*3-26:IF MID$(Q$,S8,2)="  "THEN 3360
3320 S1=INT(S1-X1):S2=INT(S2-X2):PRINT"WARP ENGINES SHUT DOWN AT ";
3350 PRINT"SECTOR";S1;",";S2;"DUE TO BAD NAVAGATION":GOTO 3370
3360 NEXT I:S1=INT(S1):S2=INT(S2)
3370 A$="<*>":Z1=INT(S1):Z2=INT(S2):GOSUB 8670:GOSUB 3910:T8=1
3430 IF W1<1 THEN T8=.1*INT(10*W1)
3450 T=T+T8:IF T>T0+T9 THEN 6220
3470 REM SEE IF DOCKED, THEN GET COMMAND
3490 REM EXCEEDED QUADRANT LIMITS
3500 X=8*Q1+X+N*X1:Y=8*Q2+Y+N*X2:Q1=INT(X/8):Q2=INT(Y/8):S1=INT(X-Q1*8)
3550 S2=INT(Y-Q2*8):IF S1=0 THEN Q1=Q1-1:S1=8
3590 IF S2=0 THEN Q2=Q2-1:S2=8
3620 X5=0:IF Q1<1 THEN X5=1:Q1=1:S1=1
3670 IF Q1>8 THEN X5=1:Q1=8:S1=8
3710 IF Q2<1 THEN X5=1:Q2=1:S2=1
3750 IF Q2>8 THEN X5=1:Q2=8:S2=8
3790 IF X5=0 THEN 3860
3800 PRINT"LT. UHURA REPORTS MESSAGE FROM STARFLEET COMMAND:"
3810 PRINT"  'PERMISSION TO ATTEMPT CROSSING OF GALACTIC PERIMETER"
3820 PRINT"  IS HEREBY *DENIED*.  SHUT DOWN YOUR ENGINES.'"
3830 PRINT"CHIEF ENGINEER SCOTT REPORTS  'WARP ENGINES SHUT DOWN"
3840 PRINT"  AT SECTOR";S1;",";S2;"OF QUADRANT";Q1;",";Q2;".'"
3850 IF T>T0+T9 THEN 6220
3860 IF 8*Q1+Q2=8*Q4+Q5 THEN 3370
3870 T=T+1:GOSUB 3910:GOTO 1320
3900 REM MANEUVER ENERGY S/R **
3910 E=E-N-10:IF E>=0 THEN RETURN
3930 PRINT"SHIELD CONTROL SUPPLIES ENERGY TO COMPLETE THE MANEUVER."
3940 S=S+E:E=0:IF S<=0 THEN S=0
3990 REM LONG RANGE SENSOR SCAN CODE
4000 IF D(3)<0 THEN PRINT"LONG RANGE SENSORS ARE INOPERABLE":GOTO 1990
4030 PRINT"LONG RANGE SCAN FOR QUADRANT";Q1;",";Q2
4040 O1$="-------------------":PRINT O1$
4060 FOR I=Q1-1 TO Q1+1:N(1)=-1:N(2)=-2:N(3)=-3:FOR J=Q2-1 TO Q2+1
4120 IF I>0 AND I<9 AND J>0 AND J<9 THEN N(J-Q2+2)=G(I,J):Z(I,J)=G(I,J)
4180 NEXT J:FOR L=1 TO 3:PRINT": ";:IF N(L)<0 THEN PRINT"*** ";:GOTO 4230
4210 PRINT RIGHT$(STR$(N(L)+1000),3);" ";
4230 NEXT L:PRINT":":PRINT O1$:NEXT I:GOTO 1990
4250 REM PHASER CONTROL CODE BEGINS HERE
4260 IF D(4)<0 THEN PRINT"PHASERS INOPERATIVE":GOTO 1990
4265 IF K3>0 THEN 4330
4270 PRINT"SCIENCE OFFICER SPOCK REPORTS  'SENSORS SHOW NO ENEMY SHIPS"
4280 PRINT"                                IN THIS QUADRANT'":GOTO 1990
4330 IF D(8)<0 THEN PRINT"COMPUTER FAILURE HAMPERS ACCURACY"
4350 PRINT"PHASERS LOCKED ON TARGET;  ";
4360 PRINT"ENERGY AVAILABLE =";E;"UNITS"
4370 INPUT"NUMBER OF UNITS TO FIRE";X:IF X<=0 THEN 1990
4400 IF E-X<0 THEN 4360
4410 E=E-X:IF D(7)<0 THEN X=X*RND(1)
4450 H1=INT(X/K3):FOR I=1 TO 3:IF K(I,3)<=0 THEN 4670
4480 H=INT((H1/FND(0))*(RND(1)+2)):IF H>.15*K(I,3) THEN 4530
4500 PRINT"SENSORS SHOW NO DAMAGE TO ENEMY AT ";K(I,1);",";K(I,2):GOTO 4670
4530 K(I,3)=K(I,3)-H:PRINT H;"UNIT HIT ON KLINGON AT SECTOR";K(I,1);",";
4550 PRINT K(I,2):IF K(I,3)<=0 THEN PRINT"*** KLINGON DESTROYED ***":GOTO 4580
4560 PRINT"   (SENSORS SHOW";K(I,3);"UNITS REMAINING)":GOTO 4670
4580 K3=K3-1:K9=K9-1:Z1=K(I,1):Z2=K(I,2):A$="   ":GOSUB 8670
4650 K(I,3)=0:G(Q1,Q2)=G(Q1,Q2)-100:Z(Q1,Q2)=G(Q1,Q2):IF K9<=0 THEN 6370
4670 NEXT I:GOSUB 6000:GOTO 1990
4690 REM PHOTON TORPEDO CODE BEGINS HERE
4700 IF P<=0 THEN PRINT"ALL PHOTON TORPEDOES EXPENDED":GOTO 1990
4730 IF D(5)<0 THEN PRINT"PHOTON TUBES ARE NOT OPERATIONAL":GOTO 1990
4760 INPUT"PHOTON TORPEDO COURSE (1-9)";C1:IF C1=9 THEN C1=1
4780 IF C1>=1 AND C1<9 THEN 4850
4790 PRINT"ENSIGN CHEKOV REPORTS,  'INCORRECT COURSE DATA, SIR!'"
4850 X1=C(C1,1)+(C(C1+1,1)-C(C1,1))*(C1-INT(C1)):E=E-2:P=P-1
4860 X2=C(C1,2)+(C(C1+1,2)-C(C1,2))*(C1-INT(C1)):X=S1:Y=S2
4910 PRINT"TORPEDO TRACK:"
4920 X=X+X1:Y=Y+X2:X3=INT(X+.5):Y3=INT(Y+.5)
4960 IF X3<1 OR X3>8 OR Y3<1 OR Y3>8 THEN 5490
5000 PRINT"               ";X3;",";Y3:A$="   ":Z1=X:Z2=Y:GOSUB 8830
5050 IF Z3<>0 THEN 4920
5060 A$="+K+":Z1=X:Z2=Y:GOSUB 8830:IF Z3=0 THEN 5210
5110 PRINT"*** KLINGON DESTROYED ***":K3=K3-1:K9=K9-1:IF K9<=0 THEN 6370
5150 FOR I=1 TO 3:IF X3=K(I,1) AND Y3=K(I,2) THEN 5190
5180 NEXT I:I=3
5190 K(I,3)=0:GOTO 5430
5210 A$=" * ":Z1=X:Z2=Y:GOSUB 8830:IF Z3=0 THEN 5280
5260 PRINT"STAR AT";X3;",";Y3;"ABSORBED TORPEDO ENERGY.":GOSUB 6000:GOTO 1990
5280 A$=">!<":Z1=X:Z2=Y:GOSUB 8830:IF Z3=0 THEN 4760
5330 PRINT"*** STARBASE DESTROYED ***":B3=B3-1:B9=B9-1
5360 IF B9>0 OR K9>T-T0-T9 THEN 5400
5370 PRINT"THAT DOES IT, CAPTAIN!!  YOU ARE HEREBY RELIEVED OF COMMAND"
5380 PRINT"AND SENTENCED TO 99 STARDATES AT HARD LABOR ON CYGNUS 12!!"
5400 PRINT"STARFLEET COMMAND REVIEWING YOUR RECORD TO CONSIDER"
5410 PRINT"COURT MARTIAL!":D0=0
5430 Z1=X:Z2=Y:A$="   ":GOSUB 8670
5470 G(Q1,Q2)=K3*100+B3*10+S3:Z(Q1,Q2)=G(Q1,Q2):GOSUB 6000:GOTO 1990
5490 PRINT"TORPEDO MISSED":GOSUB 6000:GOTO 1990
5520 REM SHIELD CONTROL
5530 IF D(7)<0 THEN PRINT"SHIELD CONTROL INOPERABLE":GOTO 1990
5560 PRINT"ENERGY AVAILABLE =";E+S;:INPUT"NUMBER OF UNITS TO SHIELDS";X
5580 IF X<0 OR S=X THEN PRINT"<SHIELDS UNCHANGED>":GOTO 1990
5590 IF X<=E+S THEN 5630
5600 PRINT"SHIELD CONTROL REPORTS  'THIS IS NOT THE FEDERATION TREASURY.'"
5610 PRINT"<SHIELDS UNCHANGED>":GOTO 1990
5630 E=E+S-X:S=X:PRINT"DEFLECTOR CONTROL ROOM REPORT:"
5660 PRINT"  'SHIELDS NOW AT";INT(S);"UNITS PER YOUR COMMAND.'":GOTO 1990
5680 REM DAMAGE CONTROL
5690 IF D(6)>=0 THEN 5910
5700 PRINT"DAMAGE CONTROL REPORT NOT AVAILABLE":IF D0=0 THEN 1990
5720 D3=0:FOR I=1 TO 8:IF D(I)<0 THEN D3=D3+.1
5760 NEXT I:IF D3=0 THEN 1990
5780 PRINT:D3=D3+D4:IF D3>=1 THEN D3=.9
5810 PRINT"TECHNICIANS STANDING BY TO EFFECT REPAIRS TO YOUR SHIP;"
5820 PRINT"ESTIMATED TIME TO REPAIR:";.01*INT(100*D3);"STARDATES"
5840 INPUT "WILL YOU AUTHORIZE THE REPAIR ORDER (Y/N)";A$
5860 IF A$<>"Y"THEN 1990
5870 FOR I=1 TO 8:IF D(I)<0 THEN D(I)=0
5890 NEXT I:T=T+D3+.1
5910 PRINT:PRINT"DEVICE             STATE OF REPAIR":FOR R1=1 TO 8
5920 GOSUB 8790:PRINT G2$;LEFT$(Z$,25-LEN(G2$));INT(D(R1)*100)*.01
5950 NEXT R1:PRINT:IF D0<>0 THEN 5720
5990 REM KLINGONS SHOOTING
6000 IF K3<=0 THEN RETURN
6010 IF D0<>0 THEN PRINT"STARBASE SHIELDS PROTECT THE ENTERPRISE":RETURN
6040 FOR I=1 TO 3:IF K(I,3)<=0 THEN 6200
6060 H=INT((K(I,3)/FND(1))*(2+RND(1))):S=S-H:K(I,3)=K(I,3)/(3+RND(0))
6080 PRINT H;"UNIT HIT ON ENTERPRISE FROM SECTOR";K(I,1);",";K(I,2)
6090 IF S<=0 THEN 6240
6100 PRINT"      <SHIELDS DOWN TO";S;"UNITS>":IF H<20 THEN 6200
6120 IF RND(1)>.6 OR H/S<=.02 THEN 6200
6140 R1=FNR(1):D(R1)=D(R1)-H/S-.5*RND(1):GOSUB 8790
6170 PRINT"DAMAGE CONTROL REPORTS ";G2$;" DAMAGED BY THE HIT'"
6200 NEXT I:RETURN
6210 REM END OF GAME
6220 PRINT"IT IS STARDATE";T:GOTO 6270
6240 PRINT:PRINT"THE ENTERPRISE HAS BEEN DESTROYED.  THEN FEDERATION ";
6250 PRINT"WILL BE CONQUERED":GOTO 6220
6270 PRINT"THERE WERE";K9;"KLINGON BATTLE CRUISERS LEFT AT"
6280 PRINT"THE END OF YOUR MISSION."
6290 PRINT:PRINT:IF B9=0 THEN 6360
6310 PRINT"THE FEDERATION IS IN NEED OF A NEW STARSHIP COMMANDER"
6320 PRINT"FOR A SIMILAR MISSION -- IF THERE IS A VOLUNTEER,"
6330 INPUT"LET HIM STEP FORWARD AND ENTER 'AYE'";A$:IF A$="AYE" THEN 10
6370 PRINT"CONGRULATION, CAPTAIN!  THEN LAST KLINGON BATTLE CRUISER"
6380 PRINT"MENACING THE FDERATION HAS BEEN DESTROYED.":PRINT
6400 PRINT"YOUR EFFICIENCY RATING IS";1000*(K7/(T-T0))^2:GOTO 6290
6420 REM SHORT RANGE SENSOR SCAN & STARTUP SUBROUTINE
6430 FOR I=S1-1 TO S1+1:FOR J=S2-1 TO S2+1
6450 IF INT(I+.5)<1 OR INT(I+.5)>8 OR INT(J+.5)<1 OR INT(J+.5)>8 THEN 6540
6490 A$=">!<":Z1=I:Z2=J:GOSUB 8830:IF Z3=1 THEN 6580
6540 NEXT J:NEXT I:D0=0:GOTO 6650
6580 D0=1:C$="DOCKED":E=E0:P=P0
6620 PRINT"SHIELDS DROPPED FOR DOCKING PURPOSES":S=0:GOTO 6720
6650 IF K3>0 THEN C$="*RED*":GOTO 6720
6660 C$="GREEN":IF E<E0*.1 THEN C$="YELLOW"
6720 IF D(2)>=0 THEN 6770
6730 PRINT:PRINT"*** SHORT RANGE SENSORS ARE OUT ***":PRINT:RETURN
6770 O1$="---------------------------------":PRINT O1$:FOR I=1 TO 8
6820 FOR J=(I-1)*24+1 TO (I-1)*24+22 STEP 3:PRINT" ";MID$(Q$,J,3);:NEXT J
6830 ON I GOTO 6850,6900,6960,7020,7070,7120,7180,7240
6850 PRINT"        STARDATE          ";INT(T*10)*.1:GOTO 7260
6900 PRINT"        CONDITION          ";C$:GOTO 7260
6960 PRINT"        QUADRANT          ";Q1;",";Q2:GOTO 7260
7020 PRINT"        SECTOR            ";S1;",";S2:GOTO 7260
7070 PRINT"        PHOTON TORPEDOES  ";INT(P):GOTO 7260
7120 PRINT"        TOTAL ENERGY      ";INT(E+S):GOTO 7260
7180 PRINT"        SHIELDS           ";INT(S):GOTO 7260
7240 PRINT"        KLINGONS REMAINING";INT(K9)
7260 NEXT I:PRINT O1$:RETURN
7280 REM LIBRARY COMPUTER CODE
7290 IF D(8)<0 THEN PRINT"COMPUTER DISABLED":GOTO 1990
7320 INPUT"COMPUTER ACTIVE AND AWAITING COMMAND";A:IF A<0 THEN 1990
7350 PRINT:H8=1:ON A+1 GOTO 7540,7900,8070,8500,8150,7400
7360 PRINT"FUNCTIONS AVAILABLE FROM LIBRARY-COMPUTER:"
7370 PRINT"   0 = CUMULATIVE GALACTIC RECORD"
7372 PRINT"   1 = STATUS REPORT"
7374 PRINT"   2 = PHOTON TORPEDO DATA"
7376 PRINT"   3 = STARBASE NAV DATA"
7378 PRINT"   4 = DIRECTION/DISTANCE CALCULATOR"
7380 PRINT"   5 = GALAXY 'REGION NAME' MAP":PRINT:GOTO 7320
7390 REM SETUP TO CHANGE CUM GAL RECORD TO GALAXY MAP
7400 H8=0:G5=1:PRINT"                        THE GALAXY":GOTO 7550
7530 REM CUM GALACTIC RECORD
7540 REM INPUT"DO YOU WANT A HARDCOPY? IS THE TTY ON (Y/N)";A$
7542 REM IFA$="Y"THENPOKE1229,2:POKE1237,3:NULL1
7543 PRINT:PRINT"        ";
7544 PRINT"COMPUTER RECORD OF GALAXY FOR QUADRANT";Q1;",";Q2
7550 PRINT"       1     2     3     4     5     6     7     8"
7560 O1$="     ----- ----- ----- ----- ----- ----- ----- -----"
7570 PRINT O1$:FOR I=1 TO 8:PRINT I;:IF H8=0 THEN 7740
7630 FOR J=1 TO 8:PRINT"   ";:IF Z(I,J)=0 THEN PRINT"***";:GOTO 7720
7700 PRINT RIGHT$(STR$(Z(I,J)+1000),3);
7720 NEXT J:GOTO 7850
7740 Z4=I:Z5=1:GOSUB 9030:J0=INT(15-.5*LEN(G2$)):PRINT TAB(J0);G2$;
7800 Z5=5:GOSUB 9030:J0=INT(39-.5*LEN(G2$)):PRINT TAB(J0);G2$;
7850 PRINT:PRINT O1$:NEXT I:PRINT:GOTO 1990
7890 REM STATUS REPORT
7900 PRINT "   STATUS REPORT:":X$="":IF K9>1 THEN X$="S"
7940 PRINT"KLINGON";X$;" LEFT: ";K9
7960 PRINT"MISSION MUST BE COMPLETED IN";.1*INT((T0+T9-T)*10);"STARDATES"
7970 X$="S":IF B9<2 THEN X$="":IF B9<1 THEN 8010
7980 PRINT"THE FEDERATION IS MAINTAINING";B9;"STARBASE";X$;" IN THE GALAXY"
8010 PRINT"YOUR STUPIDITY HAS LEFT YOU ON YOUR ON IN"
8020 PRINT"  THE GALAXY -- YOU HAVE NO STARBASES LEFT!":GOTO 5690
8060 REM TORPEDO, BASE NAV, D/D CALCULATOR
8070 IF K3<=0 THEN 4270
8080 X$="":IF K3>1 THEN X$="S"
8090 PRINT"FROM ENTERPRISE TO KLINGON BATTLE CRUSER";X$
8100 H8=0:FOR I=1 TO 3:IF K(I,3)<=0 THEN 8480
8110 W1=K(I,1):X=K(I,2)
8120 C1=S1:A=S2:GOTO 8220
8150 PRINT"DIRECTION/DISTANCE CALCULATOR:"
8160 PRINT"YOU ARE AT QUADRANT ";Q1;",";Q2;" SECTOR ";S1;",";S2
8170 PRINT"PLEASE ENTER":INPUT"  INITIAL COORDINATES (X,Y)";C1,A
8200 INPUT"  FINAL COORDINATES (X,Y)";W1,X
8220 X=X-A:A=C1-W1:IF X<0 THEN 8350
8250 IF A<0 THEN 8410
8260 IF X>0 THEN 8280
8270 IF A=0 THEN C1=5:GOTO 8290
8290 IF ABS(A)<=ABS(X) THEN 8330
8310 PRINT"DIRECTION =";C1+(((ABS(A)-ABS(X))+ABS(A))/ABS(A)):GOTO 8460
8330 PRINT"DIRECTION =";C1+(ABS(A)/ABS(X)):GOTO 8460
8350 IF A>0 THEN C1=3:GOTO 8420
8360 IF X<>0 THEN C1=5:GOTO 8290
8420 IF ABS(A)>=ABS(X) THEN 8450
8430 PRINT"DIRECTION =";C1+(((ABS(X)-ABS(A))+ABS(X))/ABS(X)):GOTO 8460
8450 PRINT"DIRECTION =";C1+(ABS(X)/ABS(A))
8460 PRINT"DISTANCE =";SQR(X^2+A^2):IF H8=1 THEN 1990
8480 NEXT I:GOTO 1990
8500 IF B3<>0 THEN PRINT"FROM ENTERPRISE TO STARBASE:":W1=B4:X=B5:GOTO 8120
8510 PRINT"MR. SPOCK REPORTS,  'SENSORS SHOW NO STARBASES IN THIS";
8520 PRINT" QUADRANT.'":GOTO 1990
8580 REM FIND EMPTY PLACE IN QUADRANT (FOR THINGS)
8590 R1=FNR(1):R2=FNR(1):A$="   ":Z1=R1:Z2=R2:GOSUB 8830:IF Z3=0 THEN 8590
8660 REM INSERT IN STRING ARRAY FOR QUADRANT
8670 S8=INT(Z2-.5)*3+INT(Z1-.5)*24+1
8675 IF LEN(A$)<>3 THEN PRINT"ERROR":STOP
8680 IF S8=1 THEN Q$=A$+RIGHT$(Q$,189):RETURN
8690 IF S8=190 THEN Q$=LEFT$(Q$,189)+A$:RETURN
8700 Q$=LEFT$(Q$,S8-1)+A$+RIGHT$(Q$,190-S8):RETURN
8780 REM PRINTS DEVICE NAME
8790 ON R1 GOTO 8792,8794,8796,8798,8800,8802,8804,8806
8792 G2$="WARP ENGINES":RETURN
8794 G2$="SHORT RANGE SENSORS":RETURN
8796 G2$="LONG RANGE SENSORS":RETURN
8798 G2$="PHASER CONTROL":RETURN
8800 G2$="PHOTON TUBES":RETURN
8802 G2$="DAMAGE CONTROL":RETURN
8804 G2$="SHIELD CONTROL":RETURN
8806 G2$="LIBRARY-COMPUTER":RETURN
8820 REM STRING COMPARISON IN QUADRANT ARRAY
8830 Z1=INT(Z1+.5):Z2=INT(Z2+.5):S8=(Z2-1)*3+(Z1-1)*24+1:Z3=0
8890 IF MID$(Q$,S8,3)<>A$ THEN RETURN
8900 Z3=1:RETURN
9010 REM QUADRANT NAME IN G2$ FROM Z4,Z5 (=Q1,Q2)
9020 REM CALL WITH G5=1 TO GET REGION NAME ONLY
9030 IF Z5<=4 THEN ON Z4 GOTO 9040,9050,9060,9070,9080,9090,9100,9110
9040 G2$="ANTARES":GOTO 9210
9050 G2$="RIGEL":GOTO 9210
9060 G2$="PROCYON":GOTO 9210
9070 G2$="VEGA":GOTO 9210
9080 G2$="CANOPUS":GOTO 9210
9090 G2$="ALTAIR":GOTO 9210
9100 G2$="SAGITTARIUS":GOTO 9210
9110 G2$="POLLUX":GOTO 9210
9120 ON Z4 GOTO 9130,9140,9150,9160,9170,9180,9190,9200
9130 G2$="SIRIUS":GOTO 9210
9140 G2$="DENEB":GOTO 9210
9150 G2$="CAPELLA":GOTO 9210
9160 G2$="BETELGEUSE":GOTO 9210
9170 G2$="ALDEBARAN":GOTO 9210
9180 G2$="REGULUS":GOTO 9210
9190 G2$="ARCTURUS":GOTO 9210
9200 G2$="SPICA"
9210 IF G5<>1 THEN ON Z5 GOTO 9230,9240,9250,9260,9230,9240,9250,9260
9230 G2$=G2$+" I":RETURN
9240 G2$=G2$+" II":RETURN
9250 G2$=G2$+" III":RETURN
9260 G2$=G2$+" IV":RETURN
20000 REM from superstartrekins.bas turned into subroutine
20010 REM INSTRUCTIONS FOR "SUPER STARTREK"  MAR 5, 1978
20020 FOR I=1 TO 12:PRINT:NEXT I
20021 PRINT TAB(10);"*************************************"
20022 PRINT TAB(10);"*                                   *"
20023 PRINT TAB(10);"*                                   *"
20030 PRINT TAB(10);"*      * * SUPER STAR TREK * *      *"
20031 PRINT TAB(10);"*                                   *"
20032 PRINT TAB(10);"*                                   *"
20035 PRINT TAB(10);"*************************************"
20036 FOR I=1 TO 8:PRINT:NEXT I
20040 INPUT " DO YOU NEED INSTRUCTIONS (Y/N)";K$:IF K$<>"Y" THEN 21210
20045 REM PRINT "TURN THE TTY ON-LINE AND HIT ANY KEY EXCEPT RETURN"
20046 REM IF INP(1)=13 THEN 46
20050 REM POKE 1229,2:POKE 1237,3:NULL 1
20090 PRINT"      INSTRUCTIONS FOR 'SUPER STAR TREK'"
20110 PRINT" 1. WHEN YOU SEE \COMMAND ?\ PRINTED, ENTER ONE OF THE LEGAL"
20120 PRINT"     COMMANDS (NAV,SRS,LRS,PHA,TOR,SHE,DAM,COM, OR XXX)."
20130 PRINT" 2. IF YOU SHOULD TYPE IN AN ILLEGAL COMMAND, YOU'LL GET A SHORT"
20140 PRINT"     LIST OF THE LEGAL COMMANDS PRINTED OUT."
20150 PRINT" 3. SOME COMMANDS REQUIRE YOU TO ENTER DATA (FOR EXAMPLE, THE"
20160 PRINT"     'NAV' COMMAND COMES BACK WITH 'COURSE (1-9) ?'.)  IF YOU"
20170 PRINT"     TYPE IN ILLEGAL DATA (LIKE NEGATIVE NUMBERS), THAN COMMAND"
20180 PRINT"     WILL BE ABORTED"
20270 PRINT"     THE GALAXY IS DIVIDED INTO AN 8 X 8 QUADRANT GRID,"
20280 PRINT" AND EACH QUADRANT IS FURTHER DIVIDED INTO AN 8 X 8 SECTOR GRID."
20300 PRINT"     YOU WILL BE ASSIGNED A STARTING POINT SOMEWHERE IN THE"
20310 PRINT" GALAXY TO BEGIN A TOUR OF DUTY AS COMANDER OF THE STARSHIP"
20320 PRINT" \ENTERPRISE\; YOUR MISSION: TO SEEK AND DESTROY THE FLEET OF"
20330 PRINT" KLINGON WARWHIPS WHICH ARE MENACING THE UNITED FEDERATION OF"
20340 PRINT" PLANETS."
20345 PRINT:PRINT:GOSUB 21200
20370 PRINT"     YOU HAVE THE FOLLOWING COMMANDS AVAILABLE TO YOU AS CAPTAIN"
20380 PRINT" OF THE STARSHIP ENTERPRISE:"
20390 PRINT" \NAV\ COMMAND = WARP ENGINE CONTROL --"
20400 PRINT"     COURSE IS IN A CIRCULAR NUMERICAL      4  3  2"
20410 PRINT"     VECTOR ARRANGEMENT AS SHOWN             . . ."
20420 PRINT"     INTEGER AND REAL VALUES MAY BE           ..."
20430 PRINT"     USED.  (THUS COURSE 1.5 IS HALF-     5 ---*--- 1"
20440 PRINT"     WAY BETWEEN 1 AND 2                      ..."
20450 PRINT"                                             . . ."
20460 PRINT"     VALUES MAY APPROACH 9.0, WHICH         6  7  8"
20470 PRINT"     ITSELF IS EQUIVALENT TO 1.0"
20480 PRINT"                                            COURSE"
20490 PRINT"     ONE WARP FACTOR IS THE SIZE OF "
20500 PRINT"     ONE QUADTANT.  THEREFORE, TO GET"
20510 PRINT"     FROM QUADRANT 6,5 TO 5,5, YOU WOULD"
20520 PRINT"     USE COURSE 3, WARP FACTOR 1."
20535 PRINT:PRINT:PRINT:GOSUB 21200
20540 PRINT" \SRS\ COMMAND = SHORT RANGE SENSOR SCAN"
20550 PRINT"     SHOWS YOU A SCAN OF YOUR PRESENT QUADRANT."
20560 PRINT"     SYMBOLOGY ON YOUR SENSOR SCREEN IS AS FOLLOWS:"
20570 PRINT"        <*> = YOUR STARSHIP'S POSITION"
20580 PRINT"        +K+ = KLINGON BATTLE CRUISER"
20590 PRINT"        >!< = FEDERATION STARBASE (REFUEL/REPAIR/RE-ARM HERE!)"
20600 PRINT"         *  = STAR"
20610 PRINT"     A CONDENSED 'STATUS REPORT' WILL ALSO BE PRESENTED."
20640 PRINT" \LRS\ COMMAND = LONG RANGE SENSOR SCAN"
20650 PRINT"     SHOWS CONDITIONS IN SPACE FOR ONE QUADRANT ON EACH SIDE"
20660 PRINT"     OF THE ENTERPRISE (WHICH IS IN THE MIDDLE OF THE SCAN)"
20670 PRINT"     THE SCAN IS CODED IN THE FORM \###\, WHERE TH UNITS DIGIT"
20680 PRINT"     IS THE NUMBER OF STARS, THE TENS DIGIT IS THE NUMBER OF"
20690 PRINT"     STARBASES, AND THE HUNDRESDS DIGIT IS THE NUMBER OF"
20700 PRINT"     KLINGONS."
20706 PRINT"     EXAMPLE - 207 = 2 KLINGONS, NO STARBASES, & 7 STARS."
20715 GOSUB 21200
20720 PRINT" \PHA\ COMMAND = PHASER CONTROL."
20730 PRINT"     ALLOWS YOU TO DESTROY THE KLINGON BATTLE CRUISERS BY "
20740 PRINT"     ZAPPING THEM WITH SUITABLY LARGE UNITS OF ENERGY TO"
20750 PRINT"     DEPLETE THEIR SHIELD POWER.  (REMBER, KLINGONS HAVE"
20760 PRINT"     PHASERS TOO!)"
20780 PRINT" \TOR\ COMMAND = PHOTON TORPEDO CONTROL"
20790 PRINT"     TORPEDO COURSE IS THE SAME AS USED IN WARP ENGINE CONTROL"
20800 PRINT"     IF YOU HIT THE KLINGON VESSEL, HE IS DESTROYED AND"
20810 PRINT"     CANNOT FIRE BACK AT YOU.  IF YOU MISS, YOU ARE SUBJECT TO"
20820 PRINT"     HIS PHASER FIRE.  IN EITHER CASE, YOU ARE ALSO SUBJECT TO "
20825 PRINT"     THE PHASER FIRE OF ALL OTHER KLINGONS IN THE QUADRANT."
20835 PRINT"     THE LIBRARY-COMPUTER (\COM\ COMMAND) HAS AN OPTION TO "
20840 PRINT"     COMPUTE TORPEDO TRAJECTORY FOR YOU (OPTION 2)"
20855 PRINT:PRINT:PRINT:PRINT:PRINT:GOSUB 21200
20860 PRINT" \SHE\ COMMAND = SHIELD CONTROL"
20870 PRINT"     DEFINES THE NUMBER OF ENERGY UNITS TO BE ASSIGNED TO THE"
20880 PRINT"     SHIELDS.  ENERGY IS TAKEN FROM TOTAL SHIP'S ENERGY.  NOTE"
20890 PRINT"     THAN THE STATUS DISPLAY TOTAL ENERGY INCLUDES SHIELD ENERGY"
20910 PRINT" \DAM\ COMMAND = DAMMAGE CONTROL REPORT"
20920 PRINT"     GIVES THE STATE OF REPAIR OF ALL DEVICES.  WHERE A NEGATIVE"
20930 PRINT"     'STATE OF REPAIR' SHOWS THAT THE DEVICE IS TEMPORARILY"
20940 PRINT"     DAMAGED."
20955 FOR I=1 TO 11:PRINT:NEXT I:GOSUB 21200
20960 PRINT" \COM\ COMMAND = LIBRARY-COMPUTER"
20970 PRINT"     THE LIBRARY-COMPUTER CONTAINS SIX OPTIONS:"
20980 PRINT"     OPTION 0 = CUMULATIVE GALACTIC RECORD"
20990 PRINT"        THIS OPTION SHOWES COMPUTER MEMORY OF THE RESULTS OF ALL"
21000 PRINT"        PREVIOUS SHORT AND LONG RANGE SENSOR SCANS"
21010 PRINT"     OPTION 1 = STATUS REPORT"
21020 PRINT"        THIS OPTION SHOWS THE NUMBER OF KLINGONS, STARDATES,"
21030 PRINT"        AND STARBASES REMAINING IN THE GAME."
21040 PRINT"     OPTION 2 = PHOTON TORPEDO DATA"
21050 PRINT"        WHICH GIVES DIRECTIONS AND DISTANCE FROM THE ENTERPRISE"
21060 PRINT"        TO ALL KLINGONS IN YOUR QUADRANT"
21070 PRINT"     OPTION 3 = STARBASE NAV DATA"
21080 PRINT"        THIS OPTION GIVES DIRECTION AND DISTANCE TO ANY "
21090 PRINT"        STARBASE WITHIN YOUR QUADRANT"
21100 PRINT"     OPTION 4 = DIRECTION/DISTANCE CALCULATOR"
21110 PRINT"        THIS OPTION ALLOWS YOU TO ENTER COORDINATES FOR"
21120 PRINT"        DIRECTION/DISTANCE CALCULATIONS"
21130 PRINT"     OPTION 5 = GALACTIC /REGION NAME/ MAP"
21140 PRINT"        THIS OPTION PRINTS THE NAMES OF THE SIXTEEN MAJOR "
21150 PRINT"        GALACTIC REGIONS REFERRED TO IN THE GAME."
21200 PRINT:PRINT" PRESS A KEY TO CONTINUE ";:SLEEP 500:A$=INKEY$:PRINT:PRINT
21990 REM POKE 1229,0:POKE 1237,1:NULL 0
22000 REM PRINT:PRINT:PRINT
22010 REM PRINT "TURN CASSETTE PLAYER ON AND HIT ANY KEY EXCEPT RETURN"
22020 REM IF INP(1)=13 THEN 2020
22030 REM PRINT
22040 REM PRINT "TURN CASSETTE PLAYER OFF AND "
22050 REM PRINT "TYPE 'RUN' WHEN COMPUTER PRINTS 'OK'"
Z%Z0ZMZ;Z_ZoZuZ
'$STATIC        '$DYNAMIC
L'L/L P#T#T#T#T#T
<#<+<B<I<I<\<XDhDhD}D
int>lng>sng>dbl>U
        ^_'()*+,-/:;<=>?
SETMEM@"        #GN@)   SHARED!
#TRDS   ETRIGAZ N
node found on temp stack at Stg1Loop
ListLine: text segment address trashed
Error in ListLine: Illegal opcode
DispLs2: odd node type
DispLs2: invalid node type
GetSrcLine: cx=0
LrStDeclare has invalid proc type
ListProc: invalid explicit oTyp1
ListProc: invalid explicit oTyp2
LrStDeclare has invalid oTyp
Illegal opcode found in ListLine
PushRevList: temp stack empty
PushList: temp stack empty
CharToCharTok err1
PushCommaArgs: root stack underflow
Array not defined
Simple or array variable expected
DEFxxx character specification illegal
Function name illegal
Formal parameter specification illegal
Separator illegal
Subscript syntax illegal
Invalid character
Equal sign missing
Line number or label missing
Left parenthesis missing
Minus sign missing
Right parenthesis missing
Semicolon missing
GOTO or GOSUB expected
Variable required
Argument-count mismatch
Formal parameters not unique
FOR index variable illegal
COMMON name illegal
Identifier expected
Too many TYPE definitions
TYPE not defined
TYPE more than 65535 bytes
Skipping forward to END TYPE statement
Duplicate definition
Element not defined
Asterisk missing
Integer between 1 and 32767 required
Typed variable not allowed in expression
Fixed-length string illegal
Variable-length string required
Dynamic array element illegal
Name of subprogram illegal
Only simple variables allowed
Must be first statement on the line
Block IF without END IF
ELSEIF without IF
ELSE without IF
END IF without block IF
SELECT without END SELECT
CASE without SELECT
END SELECT without SELECT
DO without LOOP
LOOP without DO
EXIT not within FOR...NEXT
EXIT DO not within DO...LOOP
Control structure in IF..THEN..ELSE incomplete
Statements/labels illegal between SELECT CASE and CASE
Advanced feature unavailable
SEG or BYVAL not allowed in CALLS
DECLARE required
Subprograms not allowed in control statements
Data-memory overflow
Too many labels
Program-memory overflow
Duplicate label
String variable required
String assignment required
Record/String assignment required
String expression required
Expression too complex
Too many arguments in function call
Too many dimensions
Too many variables for LINE INPUT
Too many named COMMON blocks
Too many variables for INPUT
Lower bound exceeds upper bound
Statement unrecognizable
Division by zero
Variable name not unique
Wrong number of dimensions
Array already dimensioned
FOR index variable already in use
FOR without NEXT
NEXT without FOR
Nested function definition
Function already defined
Function not defined
WEND without WHILE
WHILE without WEND
Missing On Error (/E) option
Missing Resume Next (/X) option
$INCLUDE-file access error
COMMON and DECLARE must precede executable statements
Subprogram error
Missing Event Trapping (/W) or Checking Between Statements (/V) option
Binary source file
Illegal type character in numeric constant
Syntax error in numeric constant
Overflow in numeric constant
SUB or FUNCTION missing
Parameter type mismatch
BYVAL allowed only with numeric arguments
String constant required for ALIAS
Identifier cannot include period
End of file unexpected in TYPE declaration
TYPE statement improperly nested
AS clause required on first declaration
AS clause required
DEF without END DEF
END DEF without DEF
SUB/FUNCTION without END SUB/FUNCTION
END SUB/FUNCTION without SUB/FUNCTION
Illegal outside of SUB, FUNCTION or DEF FN
Array not dimensioned
$Metacommand Error
Statement Ignored
CONST/DIM SHARED follows SUB/FUNCTION
Binary source file
Binary Source File
Beta Test Version
Microsoft (R) QuickBASIC Compiler Version 4.50
(C) Copyright Microsoft Corporation 1982-1988.
All rights reserved.
Simultaneously published in the U.S. and Canada.
Input file not found
 Warning Error(s)
 Severe  Error(s)
Internal error near
 Bytes Available
Label not defined:
NEXT missing for
Offset  Data    Source Line
Cannot generate listing for BASIC binary source files
Path/File access error
Source Filename [
Object Filename [
Source Listing [
Extra file name ignored
Line invalid. Start again
Colon expected after /C
/C: buffer size too large
Buffer size expected after /C:
Option unknown:
Read error on standard input
 . . . . . . . . . . . . . . . . . . . . . . .
 ( 1 : C K U ] e
Internal Error near
Memory Overflow
 0000   0000
4(414:4C4L4U4^4g4p4y4
Microsoft QuickBASIC Compiler 4.5
$$TYPES $$SYMBOLS
oOogogoWoWo_o_ooooo
rMicrosoft (R) BASIC Compiler  Version 3.00 (test)
Copyright (C) Microsoft Corp 1982-1987. All rights reserved.
DEFSNG A-Z'$STATIC
010203040506070809101112
Tue Jan 01 00:00:00 1970
D&D8D:D<D>DJD\D^D`DbDtDvD
ESunMonTueWedThuFriSat
JanFebMarAprMayJunJulAugSepOctNovDec
No such file or directory
Arg list too long
Exec format error
Bad file number
Not enough core
Permission denied
Cross-device link
Invalid argument
Too many open files
No space left on device
Result too large
Resource deadlock would occur
- floating-point error:
stack underflow
explicitly generated
- stack overflow
- integer divide by 0
- not enough space for environment
run-time error
- floating point not loaded
!Packed file is corrupt-
<DIR> COMSPEC=\COMMAND.COM
;<=>?@ABCDHKMPR:EF8
        LPT1LPT2LPT3LPT4
A:>B:>C:>D:>E:>F:>G:>MO?
 ;!<"=#>$?%@&A'B(C)D*
   $$$(((---222888???
'?--?1-?6-?:-??-??-:?-6?-1?--?1-?6-?:-??-:?-6?-1?--?--?1-?6-?:-??-:?-6?-1?
O       O       O       O       O       O       O       O       O       O       O       O       O       O       O       VW
RETURN without GOSUB
Illegal function call
Subscript out of range
Duplicate definition
Division by zero
Out of string space
String formula too complex
RESUME without error
CASE ELSE expected
Variable required
Bad file name or number
File already open
FIELD statement active
Device I/O error
File already exists
Bad record length
Input past end of file
Bad record number
Device unavailable
Communication-buffer overflow
Permission denied
Disk-media error
Advanced feature unavailable
Rename across disks
Path/File access error
Unprintable error
Redo from start
Random-number seed (-32768 to 32767)
Hit any key to return to system
Microsoft (R) QuickBASIC Compiler Runtime Version 4.50
(C) Copyright Microsoft Corporation, 1982-1988.
All rights reserved.
Simultaneously published in the U.S. and Canada.
String space corrupt
Error in EXE file
Out of stack space
No line number in
Requires DOS 2.10 or later
Error during run-time initialization
DOS memory-arena error
Far heap corrupt
- stack overflow
- floating point not loaded
- integer divide by 0
- not enough space for arguments
- not enough space for environment
- illegal near pointer use
- illegal far pointer use
- control-BREAK encountered
- unexpected interrupt
run-time error
Out of memory during CHAIN
Error in CHAIN file format
MFbbaLbLbLbVbbaVbVbVbVbJava|aVbVb<bVb^aVbVb6b
page size too small
syntax error : illegal file specification
syntax error : option name missing
syntax error : option value missing
syntax error : illegal input
comma or new line missing
terminator missing
cannot rename old library
cannot reopen library
error writing to cross-reference file
too many symbols
insufficient memory
no more virtual memory
internal failure
mark: not allocated
free: not allocated
write to extract file failed
write to library file failed
%s : cannot create extract file
cannot open response file
unexpected end-of-file on command input
cannot create new library
error writing to new library
cannot open VM.TMP
cannot write to VM
cannot read from VM
interrupted by user
%s : invalid library header
invalid object module near %lxH
%s : cannot create listing
%s : module not in library; ignored
%s : cannot access file
%s : invalid library header; file ignored
%s : invalid format (%x); file ignored
%s : module redefinition ignored
'%s' : symbol defined in module %s, redefinition ignored
%s:%s : page size invalid; ignored
%s : module not in library
output-library specification ignored
insufficient memory, extended dictionary not created
internal error, extended dictionary not created
MS Run-Time Library - Copyright (c) 1988, Microsoft Corp
%s: %08lxH  %s: %lxH
noextdictionary
Microsoft (R) Library Manager  %s 3.14
Copyright (C) Microsoft Corp 1983-1988.  %s.
Library does not exist.  Create? (y/n)
Temporary file %s has been created.
Do not change diskette in drive %c:
Output library:
Code and data size
All rights reserved
- stack overflow
- integer divide by 0
- not enough space for environment
run-time error
- floating point not loaded
- null pointer assignment
!Packed file is corrupt
%s : option name ambiguous
%s : unrecognized option name
/QUICKLIB, /EXEPACK incompatible
%s : invalid numeric value
%s : stack size exceeds 65535 bytes
%s : interrupt number exceeds 255
%s : segment limit set too high
%s : CPARMAXALLOC : illegal value
no object modules specified
cannot nest response files
response line too long
terminated by user
nested right parentheses
nested left parentheses
unmatched right parenthesis
unmatched left parenthesis
relocation table overflow
too many TYPDEF records
too many external symbols in one module
too many group, segment, and class names in one module
too many segments in one module
too many segments
too many groups in one module
too many groups
too many libraries
out of memory for symbol table
requested segment limit too high
too many overlays
data record too large
out of memory for CodeView information
%s : segment size exceeds 64K
segment _TEXT larger than 65520 bytes
common area longer than 65536 bytes
cannot open list file
out of space for run file
cannot open run file
cannot create temporary file
cannot open temporary file
scratch file missing
unexpected end-of-file on scratch file
out of space for list file
%s : cannot open response file
cannot reopen list file
unexpected end-of-file on library
%s : object not found
invalid object module
unexpected end-of-file
attempt to access data outside segment bounds
%s : not valid library
unresolved COMDEF; internal error
file not suitable for /EXEPACK; relink without
%s: option incompatible with overlays
%s : segment defined both 16- and 32-bit
fixup(s) without data
fixup overflow at %04x in segment %s
intersegment self-relative fixup at %04x in segment %s
fixup type unsupported at %04x in segment %s
%s : NEAR/HUGE conflict
%s : array-element size mismatch
LIDATA record too large
%s : special symbol already defined
%s : symbol defined more than once
'%s' : unresolved external
stack plus data exceed 64K
Quick Library support module missing
%s : symbol multiply defined, use /NOE
Microsoft Overlay Manager module not found
no segments defined
intersegment self-relative fixup at %04x in segment %s
PACKCODE value exceeding 65500 unreliable
load-high disables /EXEPACK
/CODEVIEW disables /DSALLOCATE
/CODEVIEW disables /EXEPACK
%s : code-segment size exceeds 65500
no stack segment
%s : segment declared in more than one group
more than 239 overlay segments; extra put in root
memory model mismatch
name of output file is '%s'
too many public symbols for sorting
%s : cannot find library
VM.TMP : illegal file name; ignored
%s : cannot find file
Enter new file spec:
Change diskette in drive %c and press <ENTER>
Temporary file %s has been created.
Do not change disk in drive %c:.
Please replace original diskette in drive %c and press <ENTER>
About to generate .EXE file
Valid options are:
Definitions File
There was 1 error detected
There were %d errors detected
MS Run-Time Library - Copyright (c) 1988, Microsoft Corp
%3d segment "%s"
 class "%s" length %lxH bytes
 %s %s, %s %s, %s %lx
Program entry point at %04x:%04x
FARCALLTRANSLATION
NODEFAULTLIBRARYSEARCH
NOEXTDICTIONARY
NOFARCALLTRANSLATION
NOGROUPASSOCIATION
OVERLAYINTERRUPT
 Origin   Group
 Start     Length     Name,
 Start  Stop   Length Name$
Line numbers for
Bytes in symbol table  %ld
 : %s %c%04d :
 : %s %c%04d :
Stack Allocation = %u bytes
**** PASS ONE ****
**** LIBRARY SEARCH ****
**** ASSIGN ADDRESSES ****
**** PRINT MAP ****
**** PASS TWO ****
**** WRITING EXECUTABLE ****
 %s: %lx %s: %02x
 %s: %lx %s: %02x
Program entry point at %04x:%04x
Microsoft (R) Overlay Linker  %s 3.69
Copyright (C) Microsoft Corp 1983-1988.  %s.
!Packed file is corrupt,
target external
All rights reserved
- stack overflow
- integer divide by 0
- not enough space for environment
run-time error
- floating point not loaded
- null pointer assignment
!Packed file is corrupt
*** This is Copyright 1983 Microsoft ***
(.).)&).).).).).)
%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%
*** This is copyright 1984 Microsoft ***
<St!<Ht*<Vt2<Dt
9Invalid parameter
$Driver not installed -- Internal Error 1
$Driver not installed -- Microsoft Mouse not found
$Driver not installed -- interrupt jumper missing
$Driver not installed -- multiple interrupt jumpers found
$Driver not installed -- missing interrupt jumper
$MSX Mouse driver installed
$Mouse driver installed
$Switch values passed to existing Mouse driver
$Existing Mouse driver enabled
$Existing Mouse driver removed from memory
$Existing Mouse driver disabled
$Mouse Driver not installed
$Mouse driver installed, cannot change port (/i, /c, and /b invalid)
$Mouse driver already installed
$Unable to disable Mouse driver -- Control Panel is active
$Unable to disable Mouse driver -- Mouse is active
$Microsoft (R) Mouse Driver  Version 6.24A
Copyright (C) Microsoft Corp 1983-1988.  All rights reserved.
PACKING.LST File for QuickBASIC Version 4.50
This package comes with a number of demonstration and utility programs written in BASIC.
=========================================================================================
******** ROOT directory contents ********
BC.EXE                                  The BASIC command-line compiler invoked by the Run
                                                                menu's Make EXE File command or by the bc command
                                                                from the DOS command line.
BRUN45.EXE                      The QuickBASIC run-time module; required for running
                                                                executable files created with BRUN45.LIB.
LIB.EXE                                 The Microsoft Library Manager; used to create
                                                                stand-alone (.LIB) libraries.
LINK.EXE                                The Microsoft Overlay Linker; used to create
                                                                executable files and Quick libraries.
QB.EXE                                  The QuickBASIC program development environment.
QB.INI                                  The QuickBASIC configuration file.
MOUSE.COM                               The Mouse driver for use with QuickBASIC programs
                                                                that call mouse functions.
        ******** \HLP directory contents ********
        QB45ENER.HLP            File containing on-line help information dealing with
                                                                        the QuickBASIC environment and error messages.
        QB45QCK.HLP                     File containing on-line help on QuickBASIC.
        QB45ADVR.HLP            File containing on-line help information on QuickBASIC.
        ******** \INC directory contents ********
        DEMO1.BAS                               A BASICA version of a sound-effects demonstration
                                                                        program.
        DEMO2.BAS                               The QuickBASIC 2.0 version of DEMO1.BAS.
        DEMO3.BAS                               The QuickBASIC 4.0 (and higher) version of DEMO1.BAS.
        QCARDS.BAS                      Supplied code for the QCARDS database program used
                                                                        in the Hands On with QuickBASIC tutorial. In Part 2
                                                                        of the manual Learning to Use QuickBASIC, you add
                                                                        the module-level code that completes this program.
        QCARDS.DAT                      Supplied data file for the QCARDS database program.
                                                                        Keep this file in the current directory as you add
                                                                        code during the QCARDS.BAS tutorial.
        REMLINE.BAS                     A utility program that converts BASICA programs
                                                                        saved in ASCII format to QuickBASIC-style programs
                                                                        by removing unreferenced line numbers.
        SORTDEMO.BAS            A program that uses multicolored bars and sound to
                                                                        illustrate various sorting algorithms.
        TORUS.BAS                               A graphics demonstration program that draws a
                                                                        multicolored doughnut-shaped figure on the screen,
                                                                        then animates it by shifting colors in the palette.
        QB.BI                                           An include file for use with BASIC programs that
                                                                        call any of the following routines in the QB.QLB
                                                                        Quick library or in the QB.LIB stand-alone library:
                                                                        ABSOLUTE, INTERRUPT, INTERRUPTX, INT86OLD, or
                                                                        INT86XOLD.  The QB.BI file defines the types for
                                                                        arguments passed to these routines and also gives
                                                                        DECLARE statements for these routines.
        NOEM.OBJ                                (NO EMulation). An object file to link with BASIC
                                                                        programs that will always be run on machines with an
                                                                        8087 or 80287 math coprocessor chip.  Linking with
                                                                        NOEM.OBJ turns off software emulation of the math
                                                                        chip's function, and reduces the size of the
                                                                        executable file.
        SMALLERR.OBJ            An object file to link with BASIC programs that do
                                                                        not require run-time error messages. Linking with
                                                                        SMALLERR.OBJ reduces the size of executable files
                                                                        that do not need run-time error messages.
        QB.PIF                                  A file that provides information to aid in running
                                                                        QuickBASIC under Microsoft Windows.
                \ADVR_EX                A directory containing BASIC programs cited in the on-line help.
                ******** \ADVR_EX directory contents ********
                CALL_EX.BAS                                     Illustrates using the CALL statement
                CHR_EX.BAS                                      Illustrates using the the CHR$ function
                CMD_EX.BAS                                      Illustrates using the the COMMAND$ function
                COM1_EX.BAS                                     Illustrates using the the COMMON and CHAIN statements
                COM2_EX.BAS                                     Module used in COM1_EX.BAS above
                CSR_EX.BAS                                      Illustrates using the the CSRLIN function
                DECL_EX.BAS                                     Illustrates using the DECLARE statement
                DEFFN_EX.BAS                            Illustrates using the DEF FN statement
                DEFSG_EX.BAS                            Illustrates using the DEF SEG, PEEK, and POKE statements
                DRAW_EX.BAS                                     Illustrates using the DRAW statement
                FUNC_EX.BAS                                     Illustrates using FUNCTION...END FUNCTION
                OUT_EX.BAS                                      Illustrates using the OUT statement
                SHARE_EX.BAS                            Illustrates using the SHARED statement
                SHELL_EX.BAS                            Illustrates using the SHELL statement
                STAT_EX.BAS                                     Illustrates using the STATIC statement
                SUB_EX.BAS                                      Illustrates using SUB...END SUB
                TYPE_EX.BAS                                     Illustrates using TYPE..END TYPE
                UBO_EX.BAS                                      Illustrates using the UBOUND and LBOUND functions
                UCASE_EX.BAS                            Illustrates using the UCASE$ function
                WINDO_EX.BAS                            Illustrates using the WINDOW statement
                \EXAMPLES               A directory containing BASIC programs printed in the QuickBASIC manuals and other demonstration programs.
                ******** \EXAMPLES directory contents ********
                BALLPSET.BAS                            A program that bounces a ball off the bottom and
                                                                                                sides of the screen by using the PSET option with
                                                                                                the graphics PUT statement.
                BALLXOR.BAS                                     A program that bounces a ball off the bottom and
                                                                                                sides of the screen by using the XOR option with
                                                                                                the graphics PUT statement.
                BAR.BAS                                                 A program that turns input data into a bar chart.
                CAL.BAS                                                 A program that prints a calendar for any month in
                                                                                                any year from 1899 to 2099.
                CHECK.BAS                                               A checkbook-balancing program that sorts and prints a
                                                                                                list of any deposits and withdrawals input by the
                                                                                                user, then prints the final balance in the checking
                                                                                                account.
                COLORS.BAS                                      A program showing all combinations of the 16 background
                                                                                                colors and 3 foreground colors (distinct from the
                                                                                                background) in the 2 color palettes available in screen
                                                                                                mode 1.
                CRLF.BAS                                                A program that opens an ASCII file, expands any lines
                                                                                                ending with just a carriage return or a line feed to
                                                                                                a carriage-return--line-feed combination, then writes
                                                                                                the adjusted lines to a new file.
                CUBE.BAS                                                A program that illustrates simple animation of a
                                                                                                cube by using multiple screen pages in screen mode 7.
                EDPAT.BAS                                               A program that allows you to edit a pattern tile
                                                                                                for use in a PAINT statement.  With pattern tiles,
                                                                                                you can fill any enclosed graphics area on the screen
                                                                                                with a pattern.
                ENTAB.BAS                                               A program that compresses an ASCII file by replacing
                                                                                                runs of spaces with tab characters.
                FILERR.BAS                                      A program that searches for a string of characters in
                                                                                                an ASCII file.  This program traps and handles common
                                                                                                file-access errors such as the user's entering an
                                                                                                invalid file name or leaving a drive door open.
                FLPT.BAS                                                A program that lets you examine the internal format
                                                                                                used by BASIC to store single-precision numbers.
                INDEX.BAS                                               A file I/O program that builds and searches an index
                                                                                                of record numbers from a random-access data file.
                MANDEL.BAS                                      A program that generates a fractal (a colorful graphic
                                                                                                representation of the properties of certain real
                                                                                                numbers) on the screen.
                PALETTE.BAS                                     A program that demonstrates how to give the illusion
                                                                                                of movement by rotating the colors displayed by
                                                                                                the color attributes from 1 to 15.
                PLOTTER.BAS                                     A simple line-sketching program that uses BASIC's
                                                                                                DRAW statement.
                QLBDUMP.BAS                                     A program that allows you to get a listing of the
                                                                                                PUBLIC code and data symbols in a QuickBASIC Quick
                                                                                                library.
                SEARCH.BAS                                      A program that searches any disk file for a pattern
                                                                                                and reports every byte position in the file where
                                                                                                the pattern begins.
                SINEWAVE.BAS                            A program that plots the graph of the sine-wave
                                                                                                function for angle values from 0 to PI radians.
                STRTONUM.BAS                            A program that converts to a numeric value any number
                                                                                                input as a string, after first filtering invalid
                                                                                                numeric characters (such as commas) out of the
                                                                                                string.
                TERMINAL.BAS                            A program that turns your computer into a "dumb"
                                                                                                terminal when used with a modem.
                TOKEN.BAS                                               A program that breaks an input string into a series
                                                                                                of tokens (a string of characters delimited by
                                                                                                blank spaces, tabs, or punctuation marks such as
                                                                                                commas or semicolons).
                WHEREIS.BAS                                     A program that recursively searches through all
                                                                                                directories on a disk for a specified file name.
        ******** \LIB directory contents ********
        BRUN45.LIB                      The QuickBASIC run-time-module library; used for
                                                                        creating executable files from QuickBASIC and DOS.
        BQLB45.LIB                      The library of supporting routines that are used when
                                                                        creating Quick libraries.
        BCOM45.LIB                      The QuickBASIC alternate run-time-module library;
                                                                        used for creating executable files from QuickBASIC
                                                                        and DOS (files created with this library do not
                                                                        require BRUN45.EXE to run).
        QB.LIB                                  The stand-alone library containing support routines
                                                                        for DOS system calls.
        QB.QLB                                  The Quick library containing support routines for
                                                                        DOS system calls.
 !#$%&'()*+,-./0123456789:;<=>?ABCDEFGHIKLMNOPQRSTUVWXY[]abcdefghiklmnopqrstuvwxyz
                #       &       4       6       8       ;       O       m
        ^_'()*+,-/:;<=>?
SETMEM@"        #GN@)   SHARED!
#TRDS   ETRIGAZ N
AZuBZuCZuDZuEZuFZuGZuMov
   $$$(((---222888???
'?--?1-?6-?:-??-??-:?-6?-1?--?1-?6-?:-??-:?-6?-1?--?--?1-?6-?:-??-:?-6?-1?
 ;!<"=#>$?%@&A'B(C)D*
)x)r)o)l)i)f)c)`)u)t
 #)#2#?#F#M#T#[#b#i#p#
(=A11+.00       ,((>*
L'L/L P#T#T#T#T#T
<#<+<B<I<I<\<XDhDhD}D
yfsKuutaq*k;tRqZq;t
'k#("-.ghimdefkabc`n
S D!F"G#H$J%K&L,Z-X.C/V0B1N2M
]';(')`+\3,4.5/
Microsoft (R) QuickBASIC Version 4.50
(C) Copyright Microsoft Corporation, 1985-1988.
All rights reserved.
Simultaneously published in the U.S. and Canada.
Press Enter to see the QuickBASIC Survival Guide
Press ESC to clear this dialog box
Current ~Module
~Choose program item to edit
Edit in ~Active
Display Options
E~xecutable files:
~Include files:
~Library files:
Search Path For:
On right mouse button click:
~Context-sensitive Help
~Execute up to this line
EXE File ~Name:
Produce ~Debug Code
E~XE Requiring BRUN45.EXE
Stand-~Alone EXE File
Make EXE and ~Exit
Quick-Library File ~Name:
Produce ~Debug Code
Make Library and ~Exit
~Match Upper/Lowercase
~1. Active Window
~2. Current Module
~3. All Modules
Find and ~Verify
~Match Upper/Lowercase
~1. Active Window
~3. All Modules
RETURN without GOSUB
Illegal function call
Subscript out of range
Duplicate definition
Division by zero
Out of string space
String formula too complex
RESUME without error
CASE ELSE expected
Variable required
Bad file name or number
File already open
FIELD statement active
Device I/O error
File already exists
Bad record length
Input past end of file
Bad record number
Device unavailable
Communication-buffer overflow
Permission denied
Disk-media error
Advanced feature unavailable
Rename across disks
Path/File access error
Unprintable error
Redo from start
Random-number seed (-32768 to 32767)
Hit any key to return to system
String space corrupt
Error in EXE file
Out of stack space
No line number in
Requires DOS 2.10 or later
Error during run-time initialization
DOS memory-arena error
Far heap corrupt
- stack overflow
- floating point not loaded
- integer divide by 0
- not enough space for arguments
- not enough space for environment
- illegal near pointer use
- illegal far pointer use
- control-BREAK encountered
- unexpected interrupt
run-time error
Open Program...
Undo    Alt+Backspace
Paste   Shift+Ins
New FUNCTION...
Next SUB        Shift+F2
Output Screen   F4
Selected Text   Ctrl+\
Repeat Last Find        F3
Modify COMMAND$...
Make EXE File...
Make Library...
Set Main Module...
Instant Watch...        Shift+F9
Delete Watch...
Delete All Watch
Toggle Breakpoint       F9
Clear All Breakpoints
Break on Errors
Set Next Statement
Syntax Checking
Topic:                 F1
Help on Help    Shift+F1
_QB_INC=PATHLIB.\
<        LPT1LPT2LPT3LPT4
K"+,:;<=>[]| ;<=>?@ABCDHKMPR:EF8
<DIR> COMSPEC=\COMMAND.COM

A lot of the stuff at the top looks like a BASIC program. In BASIC, the programmer has to start each line with a number, and it’s common to go up by 10 at a time so that if something needed to be added later, they wouldn’t have to change every line after. REM is one way to make a comment. So at the top of the output, there’s a comment block describing SUPER STARTREK, a game. Some web searching shows the original source here:

image-20251109071228561

What jumps out immediately on comparing (and really even just looking at the strings) is line 211, which is clearly added in later, and is a comment with a base64-encoded string. It decodes:

oxdf@hacky$ echo "bWVycnkgY2hyaXN0bWFzIHRvIGFsbCBhbmQgdG8gYWxsIGEgZ29vZCBuaWdodAo=" | base64 -d
merry christmas to all and to all a good night

And that’s the flag.

Recover Program

Access Files

There are a couple ways to access files on a disk image like this. One is to mount it:

oxdf@hacky$ mkdir /tmp/floppy
oxdf@hacky$ sudo mount -o loop floppy.img /tmp/floppy/
oxdf@hacky$ cd /tmp/floppy/
oxdf@hacky$ find .
.
./qb45
./qb45/BC.EXE
./qb45/BRUN45.EXE
./qb45/LIB.EXE
./qb45/LINK.EXE
./qb45/MOUSE.COM
./qb45/PACKING.LST.txt
./qb45/QB.EXE
./qb45/QB.INI

7z will also provide access:

oxdf@hacky$ 7z l floppy.img
7-Zip 23.01 (x64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20
 64-bit locale=en_US.UTF-8 Threads:12 OPEN_MAX:1024                                           

Scanning the drive for archives:
1 file, 1474560 bytes (1440 KiB)

Listing archive: floppy.img

--
Path = floppy.img
Type = FAT
Physical Size = 1474560                                                                       
File System = FAT12                                                                           
Cluster Size = 512
Free Space = 871936
Headers Size = 17408
Sector Size = 512                                                                             
ID = 2617370798

   Date      Time    Attr         Size   Compressed  Name                                     
------------------- ----- ------------ ------------  ------------------------                 
2025-03-18 19:33:20 D....                            qb45                                     
2025-03-18 19:33:20 ....A        97481        97792  qb45/BC.EXE
2025-03-18 19:33:20 ....A        77440        77824  qb45/BRUN45.EXE
2025-03-18 19:33:20 ....A        35643        35840  qb45/LIB.EXE                             
2025-03-18 19:33:20 ....A        69133        69632  qb45/LINK.EXE
2025-03-18 19:33:20 ....A        14674        14848  qb45/MOUSE.COM                           
2025-03-18 19:33:20 ....A         9506         9728  qb45/PACKING.LST.txt                     
2025-03-18 19:33:20 ....A       278804       279040  qb45/QB.EXE
2025-03-18 19:33:20 ....A           69          512  qb45/QB.INI
------------------- ----- ------------ ------------  ------------------------                 
2025-03-18 19:33:20             582750       585216  8 files, 1 folders 

I can dive into these, but they aren’t super interesting on their own. They are each parts of the Microsoft BASIC compiler. For example, I can run QB.EXE with dosbox and it will prompt for a source file to compile:

image-20251109073013769
  • MOUSE.COM - Microsoft Mouse Driver Version 6.24A
  • BRUN45.EXE - Microsoft QuickBASIC Compiler Runtime Version 4.50
  • LIB.EXE - Microsoft Library Manage Version 3.14
  • LINK.EXE - Microsoft Overlay Linker Version 3.69

These are also laid out in PACKING.LST.TXT:

oxdf@hacky$ cat /tmp/floppy/qb45/PACKING.LST.txt
PACKING.LST File for QuickBASIC Version 4.50
This package comes with a number of demonstration and utility programs written in BASIC.
=========================================================================================
******** ROOT directory contents ********
BC.EXE                                  The BASIC command-line compiler invoked by the Run
                                                                menu's Make EXE File command or by the bc command
                                                                from the DOS command line.
BRUN45.EXE                      The QuickBASIC run-time module; required for running
                                                                executable files created with BRUN45.LIB.
LIB.EXE                                 The Microsoft Library Manager; used to create
                                                                stand-alone (.LIB) libraries.
LINK.EXE                                The Microsoft Overlay Linker; used to create
                                                                executable files and Quick libraries.
QB.EXE                                  The QuickBASIC program development environment.
QB.INI                                  The QuickBASIC configuration file.
MOUSE.COM                               The Mouse driver for use with QuickBASIC programs
                                                                that call mouse functions.

        ******** \HLP directory contents ********
        QB45ENER.HLP            File containing on-line help information dealing with
                                                                        the QuickBASIC environment and error messages.
        QB45QCK.HLP                     File containing on-line help on QuickBASIC.
        QB45ADVR.HLP            File containing on-line help information on QuickBASIC.

        ******** \INC directory contents ********
        DEMO1.BAS                               A BASICA version of a sound-effects demonstration
                                                                        program.
        DEMO2.BAS                               The QuickBASIC 2.0 version of DEMO1.BAS.
        DEMO3.BAS                               The QuickBASIC 4.0 (and higher) version of DEMO1.BAS.
        QCARDS.BAS                      Supplied code for the QCARDS database program used
                                                                        in the Hands On with QuickBASIC       tutorial. In Part 2
                                                                        of the manual Learning to Use QuickBASIC, you add
                                                                        the module-level code that completes this program.
        QCARDS.DAT                      Supplied data file for the QCARDS database program.
                                                                        Keep this file in the current directory       as you add
                                                                        code during the QCARDS.BAS tutorial.
        REMLINE.BAS                     A utility program that converts BASICA programs
                                                                        saved in ASCII format to QuickBASIC-style programs
                                                                        by removing unreferenced line numbers.
        SORTDEMO.BAS            A program that uses multicolored bars and sound to
                                                                        illustrate various sorting algorithms.
        TORUS.BAS                               A graphics demonstration program that draws a
                                                                        multicolored doughnut-shaped figure on the screen,
                                                                        then animates it by shifting colors in the palette.
        QB.BI                                           An include file for use with BASIC programs that
                                                                        call any of the following routines in the QB.QLB
                                                                        Quick library or in the       QB.LIB stand-alone library:
                                                                        ABSOLUTE, INTERRUPT, INTERRUPTX, INT86OLD, or
                                                                        INT86XOLD.  The QB.BI file defines the types for
                                                                        arguments passed to these routines and also gives
                                                                        DECLARE statements for these routines.
        NOEM.OBJ                                (NO EMulation). An object file to link with BASIC
                                                                        programs that will always be run on machines with an
                                                                        8087 or 80287 math coprocessor chip.  Linking with
                                                                        NOEM.OBJ turns off software emulation of the math
                                                                        chip's function, and reduces the size of the
                                                                        executable file.
        SMALLERR.OBJ            An object file to link with BASIC programs that do
                                                                        not require run-time error messages. Linking with
                                                                        SMALLERR.OBJ reduces the size of executable files
                                                                        that do not need run-time error       messages.
        QB.PIF                                  A file that provides information to aid in running
                                                                        QuickBASIC under Microsoft Windows.

                \ADVR_EX                A directory containing BASIC programs cited in the on-line help.
                ******** \ADVR_EX directory contents ********
                CALL_EX.BAS                                     Illustrates using the CALL statement
                CHR_EX.BAS                                      Illustrates using the the CHR$ function
                CMD_EX.BAS                                      Illustrates using the the COMMAND$ function
                COM1_EX.BAS                                     Illustrates using the the COMMON and CHAIN statements
                COM2_EX.BAS                                     Module used in COM1_EX.BAS above
                CSR_EX.BAS                                      Illustrates using the the CSRLIN function
                DECL_EX.BAS                                     Illustrates using the DECLARE statement
                DEFFN_EX.BAS                            Illustrates using the DEF FN statement
                DEFSG_EX.BAS                            Illustrates using the DEF SEG, PEEK, and POKE statements
                DRAW_EX.BAS                                     Illustrates using the DRAW statement
                FUNC_EX.BAS                                     Illustrates using FUNCTION...END FUNCTION
                OUT_EX.BAS                                      Illustrates using the OUT statement
                SHARE_EX.BAS                            Illustrates using the SHARED statement
                SHELL_EX.BAS                            Illustrates using the SHELL statement
                STAT_EX.BAS                                     Illustrates using the STATIC statement
                SUB_EX.BAS                                      Illustrates using SUB...END SUB
                TYPE_EX.BAS                                     Illustrates using TYPE..END TYPE
                UBO_EX.BAS                                      Illustrates using the UBOUND and LBOUND functions
                UCASE_EX.BAS                            Illustrates using the UCASE$ function
                WINDO_EX.BAS                            Illustrates using the WINDOW statement

                \EXAMPLES               A directory containing BASIC programs printed in the QuickBASIC manuals and other demonstration programs.
                ******** \EXAMPLES directory contents ********
                BALLPSET.BAS                            A program that bounces a ball off the bottom and
                                                                                             sides of the screen by using the PSET option with
                                                                                             the graphics PUT statement.
                BALLXOR.BAS                                     A program that bounces a ball off the bottom and
                                                                                             sides of the screen by using the XOR option with
                                                                                             the graphics PUT statement.
                BAR.BAS                                                 A program that turns input data       into a bar chart.
                CAL.BAS                                                 A program that prints a       calendar for any month in
                                                                                             any year from 1899 to 2099.
                CHECK.BAS                                               A checkbook-balancing program that sorts and prints a
                                                                                             list of  any deposits and withdrawals input by the
                                                                                             user, then prints the final balance in the checking
                                                                                             account.
                COLORS.BAS                                      A program showing all combinations of the 16 background
                                                                                             colors and 3 foreground  colors (distinct from the
                                                                                             background) in the 2 color palettes available in screen
                                                                                             mode 1.
                CRLF.BAS                                                A program that opens an       ASCII file, expands any lines
                                                                                             ending with just a carriage return or a  line feed to
                                                                                             a carriage-return--line-feed combination, then writes
                                                                                             the adjusted lines to a  new file.
                CUBE.BAS                                                A program that illustrates simple animation of a
                                                                                             cube by  using multiple screen pages in screen mode 7.
                EDPAT.BAS                                               A program that allows you to edit a pattern tile
                                                                                             for use  in a PAINT statement.  With pattern tiles,
                                                                                             you can  fill any enclosed graphics area on the screen
                                                                                             with a pattern.
                ENTAB.BAS                                               A program that compresses an ASCII file       by replacing
                                                                                             runs of  spaces with tab characters.
                FILERR.BAS                                      A program that searches for a string of       characters in
                                                                                             an ASCII file.   This program traps and handles common
                                                                                             file-access errors such  as the user's entering an
                                                                                             invalid  file name or leaving a drive door open.
                FLPT.BAS                                                A program that lets you       examine the internal format
                                                                                             used by  BASIC to store single-precision numbers.
                INDEX.BAS                                               A file I/O program that       builds and searches an index
                                                                                             of record numbers from a random-access data file.
                MANDEL.BAS                                      A program that generates a fractal (a colorful graphic
                                                                                             representation of the properties of certain real
                                                                                             numbers) on the  screen.
                PALETTE.BAS                                     A program that demonstrates how       to give the illusion
                                                                                             of movement by rotating  the colors displayed by
                                                                                             the color attributes from 1 to 15.
                PLOTTER.BAS                                     A simple line-sketching program       that uses BASIC's
                                                                                             DRAW statement.
                QLBDUMP.BAS                                     A program that allows you to get a listing of the
                                                                                             PUBLIC code and  data symbols in a QuickBASIC Quick
                                                                                             library.
                SEARCH.BAS                                      A program that searches any disk file for a pattern
                                                                                             and reports every byte position  in the file where
                                                                                             the pattern begins.
                SINEWAVE.BAS                            A program that plots the graph of the sine-wave
                                                                                             function for angle values from 0 to PI radians.
                STRTONUM.BAS                            A program that converts to a numeric value any number
                                                                                             input as a string, after first filtering invalid
                                                                                             numeric  characters (such as commas) out of the
                                                                                             string.
                TERMINAL.BAS                            A program that turns your computer into       a "dumb"
                                                                                             terminal when used with  a modem.
                TOKEN.BAS                                               A program that breaks an input string into a series
                                                                                             of tokens (a string of characters delimited by
                                                                                             blank spaces, tabs, or punctuation marks such as
                                                                                             commas or semicolons).
                WHEREIS.BAS                                     A program that recursively searches through all
                                                                                             directories on a disk for a specified file name.

        ******** \LIB directory contents ********
        BRUN45.LIB                      The QuickBASIC run-time-module library; used for
                                                                        creating executable files from QuickBASIC and DOS.
        BQLB45.LIB                      The library of supporting routines that are used when
                                                                        creating Quick libraries.
        BCOM45.LIB                      The QuickBASIC alternate run-time-module library;
                                                                        used for creating executable files from       QuickBASIC
                                                                        and DOS (files created with this library do not
                                                                        require BRUN45.EXE to run).
        QB.LIB                                  The stand-alone library containing support routines
                                                                        for DOS system calls.
        QB.QLB                                  The Quick library containing support routines for
                                                                        DOS system calls.

Recover Deleted Files

So far I just have standard Microsoft stuff. fls is a neat program from the open source digital forensics tool suite The Sleuth Kit. It’s one of the tools that comes with sudo apt install sleuthkit. It will look at disk images and show not only files but deleted files:

oxdf@hacky$ fls -r floppy.img 
r/r * 6:        all_i-want_for_christmas.bas
d/d 8:  qb45
+ r/r 1189:     BC.EXE
+ r/r 1190:     BRUN45.EXE
+ r/r 1191:     LIB.EXE
+ r/r 1192:     LINK.EXE
+ r/r 1193:     MOUSE.COM
+ r/r 1196:     PACKING.LST.txt
+ r/r 1197:     QB.EXE
+ r/r 1198:     QB.INI
r/r * 10:       .all_i-want_f
v/v 45779:      $MBR
v/v 45780:      $FAT1
v/v 45781:      $FAT2
V/V 45782:      $OrphanFiles

The * marks a file as deleted. The -d flag will show only deleted files:

oxdf@hacky$ fls -r -d floppy.img 
r/r * 6:        all_i-want_for_christmas.bas
r/r * 10:       .all_i-want_f

I’ll use another file from The Sleuth Kit, icat to read these files:

oxdf@hacky$ icat floppy.img 6 > all_i-want_for_christmas.bas
oxdf@hacky$ file all_i-want_for_christmas.bas
all_i-want_for_christmas.bas: ASCII text
oxdf@hacky$ icat floppy.img 10 > .all_i-want_f
oxdf@hacky$ file .all_i-want_f
.all_i-want_f: Nano swap file, pid 4209, user mark, host arcade, file all_i-want_for_christmas.bas, modified

Swap

Swap files are used by text editors to keep track of changes in the files they are editing in case they crash without saving. The file is mostly null bytes, but there’s some data here:

oxdf@hacky$ cat .all_i-want_f | xxd | grep -v "0000 0000 0000 0000 0000 0000 0000 0000"
00000000: 6230 6e61 6e6f 2037 2e32 0000 0000 0000  b0nano 7.2......
00000010: 0000 0000 0000 0000 7110 0000 6d61 726b  ........q...mark
00000040: 0000 0000 6172 6361 6465 0000 0000 0000  ....arcade......
00000060: 0000 0000 0000 0000 0000 0000 616c 6c5f  ............all_
00000070: 692d 7761 6e74 5f66 6f72 5f63 6872 6973  i-want_for_chris
00000080: 746d 6173 2e62 6173 0000 0000 0000 0000  tmas.bas........
000003e0: 0000 0000 0000 0000 0000 0000 0000 0055  ...............U

The editor in use is nano 7.2. The host name is arcade, and the user editing the file is mark. 0x1071 at offset 0x18 is the PID, which is 4209. The file being edited is all_i-want_for_christmas.bas.

With the rest of the file being nulls, there’s no real interesting data or unrecovered changes.

Play Game

I’ll open dosbox in the directory where I have both the recovered .bas code and the qb45 directory with the tools. To get access to these, I’ll run the mount command, which takes a drive letter and a local directory:

image-20251109075807070

Old DOS was limited in filename length to 8 characters before the dot and extension, and used the ~ + digit to shorten names that were too long. ALL_I-~2.BAS is the basic source. I’ll compile and run it with QB.EXE running QB45\QB.EXE ALL_I-~2.BAS, which opens it in QBASIC:

image-20251109080127774

F5 will run it:

image-20251109080149058

On entering “N” there’s a splash:

image-20251109080159089

And then the game:

image-20251109080239812

Outro

Retro Recovery

Congratulations! You have completed the Retro Recovery challenge!

Mark approves:

Mark Devito

Mark Devito

Excellent work! You’ve successfully recovered that deleted file and decoded the hidden message.

Sometimes the old ways are the best ways. Vintage file systems never truly forget what they’ve seen. Play some Star Trek… it actually works.