Category : Printer + Display Graphics
Archive   : VGASTARS.ZIP
Filename : VGASTARS.BAS

 
Output of file : VGASTARS.BAS contained in archive : VGASTARS.ZIP
' ************************************
' * Program VGASTARS Version 8911 *
' ************************************

' Program VGASTARS has been written to take advantage of the improved
' graphics capabilities of the 80286 or 80386 system equipped with a VGA
' Graphics Adapter and a VGA Color Display. The program automatically
' detects if a Microsoft Mouse is present and invokes mouse operations
' if so.

' Compiled with QuickBASIC, V4.50 and Mouse Tools, V6.0.

REM $DYNAMIC

CONST PI# = 3.141592653589793#
CONST RADIAN# = PI / 180#

PROG$ = "VGASTARS"
VERSION$ = "8911": REM Current program version
ORIGINAL$ = "From a program by Richard Berry, ASTRONOMY Magazine"
AUTHOR$ = "Written by David H. Ransom, Jr., Rancho Palos Verdes, CA"
Path$ = COMMAND$
IF RIGHT$(Path$, 1) <> "\" AND Path$ <> "" THEN Path$ = Path$ + "\"
DTBS$ = Path$ + "VGASTARS.DAT": ARLD = 0
DTBN$ = Path$ + "VGASTARS.NAM"
DTBC$ = Path$ + "VGASTARS.CON"
DTBL$ = Path$ + "VGASTARS.LIN"
MACH$ = "80286/80386 Computer with VGA"

' The following code sets the screen size and aspect ratio
' and the number of scan lines for help and display data on
' screen.

BEGIN:
SCREEN 12
WIDTH 80, 60
SCRNACTIVE% = 0: SCRNVIEW% = 0
SCREEN 12, , SCRNACTIVE%, SCRNVIEW%
SX = 640: SY = 480: YHT = 1: REM EGA/ECD graphics
HSCREEN = 10: REM Set size of help line at bottom
SY = SY - HSCREEN
RFACTOR% = 45
CENTX = SX / 2: CENTY = SY / 2
CLS : KEY OFF
DIM RA(1600), DEC(1600), MAG%(1600), STARABBR$(1600), MARK%(1600)
DIM XCOORD%(1600), YCOORD%(1600), CCOLOR%(22), CONCOLOR$(6)
DIM STARNAME$(200), CONNAME$(91), LINNAME$(90)

FIRST% = 1
SAYSTAR% = 0
LASTLINE% = 60
LDRAW% = 1: XPOINT1% = -1: REM Initial values for line drawing on

'---- INFORMATION SCREEN ----------------------------------

' The first time the program is executed, it automatically sets
' parameters for Ursa Major (The Big Dipper) and superimposes
' the program name on the screen for visual effect.

INFOSCREEN:
IF FIRST% = 1 THEN
IF NOT ARLD THEN GOSUB LOADSTARS: CLS
RA0 = 11.15: DEC0 = 50.68: WID = 120
GFLAG% = 1
ELSE
GOSUB PROGNAME
LOCATE 21, 10, 1
INPUT ; "Enter the RA of the field center: ", RA0
LOCATE 22, 10, 1
INPUT ; "Enter the DEC of the field center: ", DEC0
LOCATE 23, 10, 1
INPUT ; "Enter the WIDTH of the field in degrees: ", WID
END IF
RASTART = RA0
DECSTART = DEC0
WIDSTART = WID
LOWMAG% = 60: REM Minimum magnitude displayed
IF MOUSEFLAG% = 0 THEN CFLAG% = 1 ELSE CFLAG% = -1
XC0% = CENTX: YC0% = CENTY: REM Set initial crosshair position
XC% = XC0%: YC% = YC0%
IF FIRST% = 1 THEN
FOR K% = 1 TO NUM%: MARK%(K%) = 15: NEXT
FOR K% = 1 TO 6: CONCOLOR$(K%) = " ": NEXT
SFLAG% = 0: MFLAG% = 0: CCFLAG% = 0
CONSTEL$ = "UMA": GOTO MARKCONST0
END IF

REDRAW:
GOSUB KILLCURSOR
GOSUB REDRAW1
GOSUB DRAWCURSOR
GOTO WAITFORKEY

REDRAW1:
STIME = TIMER
XPOINT1% = -1
CLS
FOR M% = 0 TO NUM%: XCOORD%(M%) = -1: YCOORD%(M%) = -1: NEXT
XC% = XC0%: YC% = YC0%
IF LOWMAG% = 30 THEN LOWMAG% = 70
IF WID > 360 THEN WID = 360
IF WID < 1 THEN WID = 1
IF RA0 >= 24 THEN RA0 = RA0 - 24
IF RA0 < 0 THEN RA0 = RA0 + 24
IF DEC0 > 90 THEN DEC0 = 90
IF DEC0 < -90 THEN DEC0 = -90
RAGRID = RA0: DECGRID = DEC0
R = SX * RFACTOR% / WID: R2 = -R * 2: LAM0 = .261845 * RA0: PHI0 = DEC0 * RADIAN
GOSUB SHOWMODE
GOSUB ERASELAST
COLOR 12
PRINT "Plotting ...";
COLOR 7
LINE (0, 0)-(SX - 1, SY - 1), , B

'---- PLOT THE STAR MAP ON SCREEN -------------------------

A = SIN(PHI0): B = COS(PHI0)
SXMAX = SX - 1: SYMAX = SY - 1
PLOTTED% = 0
FOR J% = 1 TO NUM%
PHI = DEC(J%): DLAM = RA(J%) - LAM0
C = SIN(PHI): D = COS(PHI): E = SIN(DLAM): F = COS(DLAM): G = D * F
K0 = R2 / (1 + A * C + B * G)
Y = K0 * (B * C - A * G) * YHT + CENTY
IF Y >= SYMAX OR Y < 1 THEN GOTO PLOTMAP1
X = K0 * D * E + CENTX
IF X >= SXMAX OR X < 1 THEN GOTO PLOTMAP1
X% = X: XCOORD%(J%) = X%: Y% = Y: YCOORD%(J%) = Y%: REM Save coordinates for star find
IMAG% = MAG%(J%): IMARK% = MARK%(J%)
GOSUB PLOTSTAR
PLOTTED% = PLOTTED% + 1
PLOTMAP1:
NEXT J%
GOSUB ERASELAST
GOSUB SHOWMODE
GOSUB SHOWCOLOR
IF GFLAG% = 1 THEN GOSUB PLOTGRID
FTIME = TIMER
GOSUB SHOWTIME
IF MOUSEFLAG% = 1 THEN
M1% = 4
M3% = XC0%
M4% = YC0%
CALL MOUSE(M1%, M2%, M3%, M4%)
END IF
IF FIRST% = 1 THEN
CONSTEL$ = "DIP"
GOSUB DRAWCONST
LDRAW% = -1: XPOINT1% = -1
GOSUB PROGNAME
GOSUB SHOWMODE
BEEP
FIRST% = 0
END IF
IF DRAWLINES% = 1 THEN XPOINT1% = -1: GOSUB DRAWCONST: DRAWLINES% = 0: XPOINT1% = -1
RETURN

' ---- PROCESS KEYBOARD INPUT -----------------------------

WAITFORKEY:
IF SAYSTAR% = 1 THEN GOSUB STARID: SAYSTAR% = 0
IF SAYCON% > 0 THEN GOSUB CONID
IF MOUSEFLAG% = 1 THEN
M1% = 5: REM GET BUTTON PRESS INFO
M2% = 0: REM TEST LEFT BUTTON
CALL MOUSE(M1%, M2%, M3%, M4%): REM CALL MOUSE
IF M2% = 0 THEN GOTO CHECKKEYS: REM ONLY MOVEMENT DETECTED
XC% = M3%: YC% = M4%
GOTO FINDSTAR: REM LEFT BUTTON PRESSED, FIND STAR
END IF

CHECKKEYS:
K$ = INKEY$: IF LEN(K$) = 0 THEN GOTO WAITFORKEY
IF LEN(K$) = 2 THEN GOTO FUNCTIONKEY
IF K$ = CHR$(13) THEN GOTO REPAINT
IF K$ = " " THEN GOSUB ERASELAST: GOSUB SHOWCOLOR: GOTO WAITFORKEY
K$ = UCASE$(K$)
IF K$ = "1" THEN SCREEN , , 0, 0: GOTO WAITFORKEY
IF K$ = "2" THEN SCREEN , , 1, 1: GOTO WAITFORKEY
IF K$ = "H" THEN GOSUB PLOTHORIZON: GOTO WAITFORKEY
'IF K$ = "M" THEN GOTO MOTION
IF K$ = "P" THEN GOTO PRINTSCREEN
IF K$ = "Q" THEN GOSUB KILLCURSOR: END
IF K$ = "R" THEN GOTO REDRAW
IF K$ = "S" THEN GOTO FINDSTAR
IF K$ = "W" THEN GOTO SETWIDTH
IF K$ = "Z" THEN GOTO RECOLOR1
GOTO WAITFORKEY

FUNCTIONKEY:
K$ = MID$(K$, 2, 1)
IF K$ = ";" THEN GOTO HELP1: REM Key F1
IF K$ = "<" AND MOUSEFLAG% = 0 THEN GOSUB CURSORMODE: GOTO WAITFORKEY: REM F2
IF K$ = "=" THEN GOSUB ERASELAST: GOSUB FCOORD: GOTO WAITFORKEY: REM Key F3
IF K$ = ">" THEN
GFLAG% = -GFLAG%
IF GFLAG% = 1 THEN
GOSUB KILLCURSOR: GOSUB PLOTGRID: GOSUB DRAWCURSOR
GOTO WAITFORKEY
END IF
GOTO REPAINT: REM Key F4
END IF
IF K$ = "?" THEN GOTO INFOSCREEN: REM Key F5
IF K$ = "@" THEN
IF LDRAW% = 1 THEN
LDRAW% = -1: XPOINT1% = -1
ELSE
LDRAW% = 1
END IF
GOSUB SHOWMODE
GOTO WAITFORKEY: REM Key F6
END IF
IF K$ = "A" THEN GOTO COLORCONST: REM Key F7
IF K$ = "B" THEN GOTO LOCATESTAR: REM Key F8
IF K$ = "C" THEN GOTO ADDCONST: REM Key F9
IF K$ = "D" THEN GOTO NEWCONST: REM Key F10
IF K$ = "G" THEN RA0 = RASTART: DEC0 = DECSTART: WID = WIDSTART: GOTO REDRAW: REM HOME
IF K$ = "S" THEN LOWMAG% = LOWMAG% - 10: GOTO REDRAW: REM DEL
IF K$ = "i" THEN
IF MOUSEFLAG% = 1 THEN
MOUSEFLAG% = 0
CFLAG% = 1
ELSEIF MOUSEFLAG = 0 THEN
MOUSEFLAG% = 1
CFLAG% = -1
ELSE
GOSUB ERASELAST
COLOR 12
PRINT "MOUSE NOT AVAILABLE"
BEEP
END IF
GOTO REPAINT: REM Key ALT+F2
END IF
IF K$ = "h" THEN GOTO BEGIN: REM Key ALT+F1

IF MOUSEFLAG% = 1 THEN GOTO PANKEYS: REM ALWAYS PAN W/MOUSE

IF CFLAG% = -1 THEN GOTO PANKEYS
IF K$ = "Q" THEN GOTO FINDSTAR: REM PgDn (FINDSTAR)
IF K$ = "I" THEN GOTO FINDSTAR: REM PgUp (FINDSTAR)
GOSUB KILLCURSOR
IF K$ = "G" THEN XC% = XC0%: YC% = YC0%
IF K$ = "H" THEN YC% = YC% - 1: IF YC% < 0 THEN YC% = 0
IF K$ = "P" THEN YC% = YC% + 1: IF YC% > SY - 1 THEN YC% = SY - 1
IF K$ = "K" THEN XC% = XC% - 1: IF XC% < 0 THEN XC% = 0
IF K$ = "M" THEN XC% = XC% + 1: IF XC% > SX - 1 THEN XC% = SX - 1
GOSUB DRAWCURSOR
GOTO WAITFORKEY

PANKEYS:
RAINCR = 1
IF WID < 91 THEN RAINCR = .5
IF WID < 61 THEN RAINCR = .25
IF WID < 31 THEN RAINCR = .1
DECINCR = 10
IF WID < 91 THEN DECINCR = 5
IF WID < 61 THEN DECINCR = 2.5
IF WID < 31 THEN DECINCR = 1
IF K$ = "I" THEN WID = 2 * WID / 3: GOTO REDRAW: REM PgUp (ZOOM IN)
IF K$ = "Q" THEN WID = 1.5 * WID: GOTO REDRAW: REM PgDn (ZOOM OUT)
IF K$ = "H" THEN DEC0 = DEC0 - DECINCR: GOTO REDRAW: REM pan UP
IF K$ = "P" THEN DEC0 = DEC0 + DECINCR: GOTO REDRAW: REM pan DOWN
IF K$ = "K" THEN RA0 = RA0 - RAINCR: GOTO REDRAW: REM pan LEFT
IF K$ = "M" THEN RA0 = RA0 + RAINCR: GOTO REDRAW: REM pan RIGHT
'LOCATE 24,2,0
'PRINT K$;
GOTO WAITFORKEY

'---- SHOW ELAPSED TIME -----------------------------------

SHOWTIME:
RETURN
LOCATE LASTLINE%, 1, 0
COLOR 9: PRINT USING "####.####"; FTIME - STIME;
RETURN

'---- SHOW MOTION ON SCREEN -------------------------------

' MOTION NOT AVAILABLE IN VGA VERSION!!!

'MOTION:
' ELAPSED = 0
' GOSUB KILLCURSOR
' GOSUB ERASELAST
' COLOR 3: PRINT "Automatic Motion ...";
' COLOR 2: PRINT " SPACE to stop";
'MOTION1:
' RA0 = RA0 + .25
' ELAPSED = ELAPSED + 1
' IF ELAPSED = 96 THEN ELAPSED = 0
' GOSUB REDRAW1
' GOSUB ERASELAST
' COLOR 3: PRINT "Automatic Motion ...";
' COLOR 2: PRINT " SPACE to stop";
' COLOR 3: PRINT " Elapsed time: ";
' COLOR 6: PRINT USING "##.##"; ELAPSED / 4;
' PRINT " hours";
' K$ = INKEY$: IF K$ <> " " THEN GOTO MOTION1
' GOSUB ERASELAST
' GOSUB SHOWCOLOR
' GOSUB DRAWCURSOR
' GOTO WAITFORKEY

'---- PRINT SCREEN ON LASERJET ----------------------------

PRINTSCREEN:
GOSUB KILLCURSOR
T1$ = "VGASTARS.T1$"
T2$ = "VGASTARS.T2$"
E$ = CHR$(27)
LJHead$ = E$ + "&a10L": ' LEFT MARGIN = 10
LJHead$ = LJHead$ + E$ + "*t100R": ' RESOLUTION = 100 DPI
LJHead$ = LJHead$ + E$ + "*r1A": ' INITIALIZE GRAPHICS
LJData$ = E$ + "*b80W": ' BEGINNING OF DATA (80 BYTES/ROW)
LJTail$ = E$ + "*rB": ' END OF GRAPHICS

' Convert screen to black and white

FOR Y% = 0 TO 479
FOR X% = 0 TO 639
IF POINT(X%, Y%) > 0 THEN PSET (X%, Y%), 15
NEXT: NEXT

' Save screen to disk

DEF SEG = &HA000
BSAVE T1$, 0, 38400: ' 640 * 480 / 8 = BYTES/SCREEN
DEF SEG

OPEN T1$ FOR INPUT AS #10: ' OPEN BSAVED FILE
K$ = INPUT$(7, 10): ' FIRST 7 BYTES NOT NEEDED
OPEN T2$ FOR OUTPUT AS #11: ' OPEN HP DOWNLOADABLE FILE
PRINT #11, LJHead$; : ' SEND HEADER TO LASERJET

PSCLOOP:
K$ = INPUT$(80, 10): ' READ 80 BYTES FROM FILE
PRINT #11, LJData$ + K$; : ' PRINT DATA SEQ PLUS 80 BYTES
IF NOT EOF(10) THEN GOTO PSCLOOP

PRINT #11, LJTail$; : ' PRINT END OF GRAPHICS
CLOSE 10: CLOSE 11

SHELL "COPY/B " + T2$ + " LPT1: >NUL": ' BINARY COPY 4X FASTER
LPRINT CHR$(12);
KILL T1$
KILL T2$
GOSUB DRAWCURSOR
GOTO WAITFORKEY


'---- REPAINT SCREEN --------------------------------------

RECOLOR1:
FOR K% = 1 TO NUM%: MARK%(K%) = 15: NEXT
FOR K% = 1 TO 6: CONCOLOR$(K%) = " ": NEXT

RECOLOR:
GOSUB KILLCURSOR
NOGRID% = 1
GOSUB ERASELAST
GOTO REPAINT1: REM Skip the clear screen if recolor

REPAINT:
GOSUB KILLCURSOR
NOGRID% = 0
CLS

REPAINT1:
COLOR 15
LINE (0, 0)-(SX - 1, SY - 1), , B
FOR K% = 1 TO NUM%
IF XCOORD%(K%) >= 0 THEN
IMAG% = MAG%(K%): IMARK% = MARK%(K%)
IF IMAG% >= 50 THEN IMARK% = IMARK% - 8
IF IMAG% > LOWMAG% THEN IMARK% = 0
X% = XCOORD%(K%): Y% = YCOORD%(K%)
PSET (X%, Y%), IMARK%
IF IMAG% < 40 THEN PSET (X% + 1, Y%), IMARK%
IF IMAG% < 30 THEN PSET (X% - 1, Y%), IMARK%
IF IMAG% < 23 THEN PSET (X%, Y% + 1), IMARK%: PSET (X%, Y% - 1), IMARK%
IF IMAG% < 15 THEN
PSET (X% + 1, Y% + 1), IMARK%: PSET (X% - 1, Y% - 1), IMARK%
PSET (X% - 1, Y% + 1), IMARK%: PSET (X% + 1, Y% - 1), IMARK%
END IF
IF IMAG% < 5 THEN PSET (X% - 2, Y%), IMARK%: PSET (X% + 2, Y%), IMARK%
END IF
NEXT
IF GFLAG% = 1 AND NOGRID% = 0 THEN GOSUB PLOTGRID
GOSUB SHOWMODE
GOSUB SHOWCOLOR
GOSUB DRAWCURSOR
IF DRAWLINES% = 1 THEN XPOINT1% = -1: GOSUB DRAWCONST: DRAWLINES% = 0: XPOINT1% = -1
GOTO WAITFORKEY

'---- SET SCREEN WIDTH IN DEGREES

SETWIDTH:
GOSUB ERASELAST
COLOR 10
PRINT "Enter the WIDTH (degrees): ";
COLOR 15
INPUT ; "", WID
GOTO REDRAW

'---- DRAW LINE BETWEEN TWO POINTS ------------------------

DRAWLINE:
GOSUB KILLCURSOR
GOSUB PLOTLINE
GOSUB DRAWCURSOR
RETURN

PLOTLINE:
DELTAX = XPOINT2% - XPOINT1%: 'IF DELTAX=0 THEN DELTAX=.000001
DELTAY = YPOINT2% - YPOINT1%: 'IF DELTAY=0 THEN DELTAY=.000001
I% = 0
IF ABS(DELTAX) < ABS(DELTAY) THEN GOTO PLOTLINE1
IF XPOINT2% > XPOINT1% THEN INCR% = 1 ELSE INCR% = -1
IF DELTAY <> 0 THEN SLOPE! = DELTAY / DELTAX ELSE SLOPE! = 0
FOR N% = XPOINT1% TO XPOINT2% STEP INCR%
PX% = N%: PY% = YPOINT1% + I% * SLOPE!: I% = I% + INCR%
IF POINT(PX%, PY%) = 0 THEN PSET (PX%, PY%), 12
NEXT
RETURN

PLOTLINE1:
IF YPOINT2% > YPOINT1% THEN INCR% = 1 ELSE INCR% = -1
IF DELTAX <> 0 THEN SLOPE! = DELTAX / DELTAY ELSE SLOPE! = 0
FOR N% = YPOINT1% TO YPOINT2% STEP INCR%
PY% = N%: PX% = XPOINT1% + I% * SLOPE!: I% = I% + INCR%
IF POINT(PX%, PY%) = 0 THEN PSET (PX%, PY%), 12
NEXT
RETURN

'---- PLOT GRID SUBROUTINE --------------------------------

' Use the original RA and DEC for the grid set when the
' screen was first drawn, regardless of present coords.

PLOTGRID:
GOSUB ERASELAST
STIME = TIMER
COLOR 1: PRINT "Plotting Grid ...";
SXMAX = SX - 1: SYMAX = SY - 1
MAXX = CENTX - 1: MINX = -CENTX - 2
MAXY = (CENTY - 1) / YHT: MINY = (-CENTY - 2) / YHT
R = SX * RFACTOR% / WID
R2 = 2 * R
LAM0 = .261845 * RAGRID
PHI0 = RADIAN * DECGRID
'PHI=DEC(J%):DLAM=RA(J%)-LAM0

' ---- Plot declination lines every 15 degrees

INCR = WID / 120
A = SIN(PHI0): B = COS(PHI0)
FOR N% = 75 TO -75 STEP -15
K$ = INKEY$: IF K$ = " " THEN GOTO DONEGRID
LOCATE LASTLINE%, 19, 0: COLOR 9: IF N% = 0 THEN COL% = 9 ELSE COL% = 1
PRINT USING "###"; N%; : PRINT "ø ";
PHI = N% * RADIAN: C = SIN(PHI): D = COS(PHI)
FOR M = 0 TO 240 - INCR STEP INCR
DLAM = M * .0261845 - LAM0: E = SIN(DLAM): F = COS(DLAM)
dd = 1 + A * C + B * D * F: IF dd = 0 THEN GOTO OFFSCALE1
K0 = R2 / dd
X = K0 * D * E
IF X > MAXX OR X < MINX THEN GOTO OFFSCALE1
Y = K0 * (B * C - A * D * F)
'IF Y>MAXY OR Y Y = -Y * YHT + CENTY
IF Y > SYMAX OR Y < 1 THEN GOTO OFFSCALE1
X = -X + CENTX
X% = X: Y% = Y
IF POINT(X%, Y%) = 0 THEN PSET (X%, Y%), COL%
OFFSCALE1:
NEXT M: NEXT N%

' ---- Plot right accension lines every hour

PLOTRAGRID:
INCR = WID / 120
FOR M% = 0 TO 23
K$ = INKEY$: IF K$ = " " THEN GOTO DONEGRID
LOCATE LASTLINE%, 19, 0: COLOR 9: PRINT USING "##"; M%; : COLOR 1: PRINT " hours";
IF M% = 0 THEN COL% = 9 ELSE COL% = 1
DLAM = (M% * .261845) - LAM0
E = SIN(DLAM): F = COS(DLAM)
FOR N = 75 TO -75 STEP -INCR
PHI = N * RADIAN: C = SIN(PHI): D = COS(PHI)
dd = 1 + A * C + B * D * F: IF dd = 0 THEN GOTO OFFSCALE2
K0 = R2 / dd
X = K0 * D * E
IF X > MAXX OR X < MINX THEN GOTO OFFSCALE2
Y = K0 * (B * C - A * D * F)
'IF Y>MAXY OR Y Y = -Y * YHT + CENTY
IF Y > SYMAX OR Y < 1 THEN GOTO OFFSCALE2
X = -X + CENTX
X% = X: Y% = Y: IF POINT(X%, Y%) = 0 THEN PSET (X%, Y%), COL%
OFFSCALE2:
NEXT N: NEXT M%
FTIME = TIMER
DONEGRID:
GOSUB ERASELAST
GOSUB SHOWCOLOR
GOSUB SHOWTIME
RETURN

' ---- PLOT HORIZON ON THE SCREEN ------------------------

PLOTHORIZON:
GOSUB ERASELAST
IF WID < 180 THEN
COLOR 12: PRINT "Set WIDTH to >= 180ø"; : 'CHR$(7);
RETURN
END IF
COLOR 2
PRINT "Plotting Horizon ...";
STIME = TIMER
R = SX * RFACTOR% / WID
'LAM0=.261845*0
PHI0 = RADIAN * 90
A = SIN(PHI0): B = COS(PHI0)
'C=0: D=1
'M%=0
DLAM = 0
E = SIN(DLAM): F = COS(DLAM)
dd = 1 + B * F: IF dd = 0 THEN dd = 1E-10
K0 = 2 / dd: X = R * K0 * E: Y = R * K0 * (-A * F)
VIEW (0, 0)-(SX - 1, SY - 1)
CIRCLE (CENTX, CENTY), -Y, 10
PAINT (2, 2), 0, 10
PAINT (2, 323), 0, 10
PAINT (638, 2), 0, 10
PAINT (638, 323), 0, 10
'LINE (0,0)-(SX-1,SY-1),7,B
FTIME = TIMER
GOSUB ERASELAST
GOSUB SHOWCOLOR
GOSUB SHOWTIME
RETURN

' ---- PLOT A STAR ON THE SCREEN -------------------------

PLOTSTAR:
COL% = IMARK% - 8
IF IMAG% < 50 THEN COL% = IMARK%
IF IMAG% > LOWMAG% THEN RETURN
PSET (X%, Y%), COL%
IF IMAG% < 40 THEN PSET (X% + 1, Y%), COL% ELSE RETURN
IF IMAG% < 30 THEN PSET (X% - 1, Y%), COL%: ELSE RETURN
IF IMAG% < 23 THEN PSET (X%, Y% + 1), COL%: PSET (X%, Y% - 1), COL% ELSE RETURN
IF IMAG% < 15 THEN
PSET (X% + 1, Y% + 1), COL%: PSET (X% - 1, Y% - 1), COL%
PSET (X% - 1, Y% + 1), COL%: PSET (X% + 1, Y% - 1), COL%
ELSE
RETURN
END IF
IF IMAG% < 5 THEN PSET (X% - 2, Y%), COL%: PSET (X% + 2, Y%), COL%
RETURN

' ---- LOCATE AND PLOT A STAR BY NAME --------------------

LOCATESTAR:
GOSUB KILLCURSOR
GOSUB ERASELAST
COLOR 7
PRINT "Enter STAR NAME: ";
LOCNAME$ = ""
COLOR 14
LS1:
K$ = INKEY$: IF LEN(K$) <> 1 THEN GOTO LS1
IF K$ = CHR$(27) OR K$ = CHR$(13) THEN GOTO LSCANCEL
IF K$ < " " THEN GOTO LS1
IF K$ >= "a" AND K$ <= "z" THEN K$ = CHR$(ASC(K$) AND NOT 32)
LOCNAME$ = LOCNAME$ + K$
PRINT K$;
IF LEN(LOCNAME$) < 6 THEN GOTO LS1
COLOR 7
STARNUM% = 0
FOR K% = 1 TO NUM%
IF STARABBR$(K%) = LOCNAME$ THEN STARNUM% = K%: EXIT FOR
NEXT K%
IF STARNUM% = 0 THEN GOTO LSABORT
SAYSTAR% = 1
MARK%(STARNUM%) = 10
RA0 = RA(STARNUM%) / .261843
DEC0 = DEC(STARNUM%) / RADIAN
IF WID < 90 THEN WID = 90
IF MOUSEFLAG% = 1 THEN
M1% = 4
M3% = XC0%
M4% = YC0%
CALL MOUSE(M1%, M2%, M3%, M4%)
END IF
GOSUB DRAWCURSOR
GOTO REDRAW

LSABORT:
GOSUB ERASELAST
COLOR 12
PRINT "No star: "; LOCNAME$;
BEEP
GOSUB DRAWCURSOR
GOTO WAITFORKEY

LSCANCEL:
GOSUB ERASELAST
COLOR 12
PRINT "Cancelled ...";
GOSUB DRAWCURSOR
GOTO WAITFORKEY

' ---- IDENTIFY STAR NEAREST THE CROSSHAIR ---------------

FINDSTAR:
GOSUB KILLCURSOR
GOSUB ERASELAST
COLOR 12
PRINT "Searching ...";
COLOR 7
TEST = 99999
STARNUM% = 0
FOR K% = 1 TO NUM%
IF XCOORD%(K%) < 0 THEN GOTO OFFSCREEN
'RT=SQR((XC%-XCOORD%(K%))^2+(YC%-YCOORD%(K%))^2)
RT = (XC% - XCOORD%(K%)) ^ 2 + (YC% - YCOORD%(K%)) ^ 2
IF RT < TEST THEN TEST = RT: STARNUM% = K%
OFFSCREEN:
NEXT K%
MARK%(STARNUM%) = 10
RA0 = RA(STARNUM%) / .261845
DEC0 = DEC(STARNUM%) / RADIAN
IMARK% = 10
IMAG% = MAG%(STARNUM%)
X% = XCOORD%(STARNUM%)
Y% = YCOORD%(STARNUM%)
GOSUB PLOTSTAR
XC% = XCOORD%(STARNUM%)
YC% = YCOORD%(STARNUM%)
IF LDRAW% = 1 THEN
IF XPOINT1% < 0 THEN
XPOINT1% = X%: YPOINT1% = Y%
ELSE
XPOINT2% = X%: YPOINT2% = Y%
GOSUB DRAWLINE
XPOINT1% = X%: YPOINT1% = Y%
END IF
END IF
GOSUB DRAWCURSOR
GOSUB STARID
GOTO WAITFORKEY

STARID:
GOSUB ERASELAST
NAMEFLAG% = 0
FOR I% = 1 TO STARNAME%
IF LEFT$(STARNAME$(I%), 6) = STARABBR$(STARNUM%) THEN
COLOR 10
PRINT LEFT$(STARNAME$(I%), 7);
COLOR 11
L% = LEN(STARNAME$(I%)) - 7
PRINT MID$(STARNAME$(I%), 8, L%);
COLOR 6
NAMEFLAG% = 1: EXIT FOR
END IF
NEXT
IF NAMEFLAG% = 0 THEN COLOR 10: PRINT STARABBR$(STARNUM%); " ";
GOSUB SCOORD
RETURN

' ---- MARK ALL STARS IN CONSTELLATION -------------------

' COLORCONST: Color the stars but do not replot, only repaint
' ADDCONST: Color the stars with next color and replot
' NEWCONST: Color the stars YELLOW and replot

COLORCONST:
SFLAG% = 1
CCFLAG% = 1
GOTO MARKCONST

ADDCONST:
SFLAG% = 1
CCFLAG% = 0
GOTO MARKCONST

NEWCONST:
SFLAG% = 0
MFLAG% = 0
CCFLAG% = 0

MARKCONST:
HELPFLAG% = 0
GOSUB KILLCURSOR
INDEX% = 1
COLOR 7
GOSUB ERASELAST
CONSTEL$ = ""
PRINT "Enter Name or RETURN: ";
IF MFLAG = 0 THEN COLOR 14 ELSE COLOR 15 - MFLAG%
LOCATE LASTLINE%, 23, 1

CONWAIT:
K$ = UCASE$(INKEY$): IF LEN(K$) = 0 THEN GOTO CONWAIT
IF K$ = CHR$(27) THEN GOTO REPAINT
'IF K$>="a" and K$<="z" THEN K$=CHR$(ASC(K$) AND NOT 32)
IF ASC(K$) = 8 AND LEN(CONSTEL$) > 0 THEN
R = CSRLIN
C = POS(0)
LOCATE R, C - 1, 0
PRINT " ";
LOCATE R, C - 1, 0
CONSTEL$ = LEFT$(CONSTEL$, LEN(CONSTEL$) - 1)
GOTO CONWAIT
END IF
IF ASC(K$) = 13 THEN GOTO CONHELP
IF ASC(K$) > 32 THEN
PRINT K$;
CONSTEL$ = CONSTEL$ + K$
IF LEN(CONSTEL$) < 3 THEN GOTO CONWAIT ELSE GOTO MARKCONST0
ELSE
BEEP: GOTO CONWAIT
END IF

MARKCONST0:
IF LEN(CONSTEL$) <> 3 THEN GOTO MARKCONST
RMIN = 24: RMAX = 0: DMIN = 90: DMAX = -90: STARNUM% = 0: LOWMAG% = 60
IF MFLAG% = 0 THEN IMARK% = 14 ELSE IMARK% = 15 - MFLAG%
FOR K% = 1 TO NUM%
IF MFLAG% = 0 THEN MARK%(K%) = 15
IF MARK%(K%) = IMARK% THEN MARK%(K%) = 15
IF MID$(STARABBR$(K%), 4, 3) <> CONSTEL$ THEN GOTO MARKCONST1
MARK%(K%) = IMARK%
STARNUM% = STARNUM% + 1
IF CCFLAG% = 1 THEN GOTO MARKCONST1
RA1 = RA(K%) / .261845
IF RA1 < RMIN THEN RMIN = RA1
IF RA1 > RMAX THEN RMAX = RA1
DEC1 = DEC(K%)
IF DEC1 < DMIN THEN DMIN = DEC1
IF DEC1 > DMAX THEN DMAX = DEC1
MARKCONST1:
NEXT K%
IF STARNUM% = 0 THEN
GOSUB ERASELAST
COLOR 4
PRINT "No stars for ";
COLOR 12
PRINT CONSTEL$;
COLOR 4
PRINT ", please enter a valid constellation!"; : BEEP: BEEP
CONSTEL$ = ""
GOTO CONHELP
END IF
IF MFLAG% = 0 THEN
CONCOLOR$(1) = CONSTEL$
FOR J% = 2 TO 6
CONCOLOR$(J%) = " "
NEXT
ELSE
FOR J% = 1 TO 6
IF CONCOLOR$(J%) = CONSTEL$ THEN CONCOLOR$(J%) = " "
NEXT
CONCOLOR$(MFLAG%) = CONSTEL$
END IF
FOR J% = 1 TO CONNAME%
IF CONSTEL$ = LEFT$(CONNAME$(J%), 3) THEN SAYCON% = J%: EXIT FOR
NEXT
IF FIRST% = 1 THEN SAYCON% = 0
IF MFLAG% = 0 THEN
MFLAG% = 2
ELSE
MFLAG% = MFLAG% + 1
IF MFLAG% = 7 THEN MFLAG% = 1
END IF
GOSUB DRAWCURSOR
IF LDRAW% = 1 THEN DRAWLINES% = 1 ELSE DRAWLINES% = 0
IF CCFLAG% = 1 THEN
IF HELPFLAG% = 0 THEN GOTO RECOLOR ELSE GOTO REPAINT
END IF
RA0 = (RMIN + RMAX) / 2
IF RMAX - RMIN > 12 THEN RA0 = RMAX - RMIN
DEC0 = (DMIN + DMAX) / 2 / RADIAN
IF WID < 90 THEN WID = 90
GOTO REDRAW

CONID:
IF FIRST% = 1 THEN SAYCON% = 0: RETURN
LOCATE LASTLINE%, 1, 0
COLOR 2
PRINT CONNAME$(SAYCON%);
SAYCON% = 0
RETURN

CONHELP:
CLS
HELPFLAG% = 1
COLOR 7
FOR COLUMN% = 0 TO 2
FOR K% = 1 TO 18
IF COLUMN% > 0 AND K% = 1 THEN K% = K% + 1
IF INDEX% > CONNAME% THEN EXIT FOR
C$ = CONNAME$(INDEX%)
IF MID$(C$, 1, 1) = "*" AND (K% > 1 OR COLUMN% > 0) THEN EXIT FOR
K1% = K%: IF K1% > 1 THEN K1% = K1% + 2
LOCATE K1% + 2, 25 * COLUMN% + 1, 0
COLOR 6
PRINT MID$(C$, 1, 3);
IF COLUMN% = 0 AND K% = 1 THEN COLOR 2 ELSE COLOR 7
L% = LEN(C$)
IF MID$(C$, L%, 1) <> "*" THEN
PRINT MID$(C$, 4, L% - 3);
ELSE
PRINT MID$(C$, 4, L% - 4);
COLOR 1
PRINT MID$(C$, L%, 1);
END IF
INDEX% = INDEX% + 1
NEXT K%
IF INDEX% > CONNAME% THEN EXIT FOR
IF MID$(C$, 1, 1) = "*" AND (K% > 1 OR COLUMN% > 0) THEN EXIT FOR
NEXT COLUMN%
CONHELP1:
COLOR 2
LOCATE 24, 1
PRINT "Names marked with ";
COLOR 1
PRINT "* ";
COLOR 2
PRINT "are PTOLEMAIC constellations dating from Ancient Greece."
LOCATE 27, 1
COLOR 7
IF INDEX% >= CONNAME% THEN INDEX% = 1
PRINT SPACE$(75)
LOCATE 27, 1, 1, 7, 8
PRINT "Enter 3-letter abbreviation or ";
COLOR 12
PRINT "RETURN";
COLOR 7
PRINT " for more constellations: ";
COLOR 14
GOTO CONWAIT

' ---- DRAW CONSTELLATION LINES ---------------------

DRAWCONST:
IF LDRAW% = -1 THEN RETURN
COUNT% = 0
FOR J% = 1 TO LINNAME%
IF LEFT$(LINNAME$(J%), 3) = CONSTEL$ THEN COUNT% = J%: EXIT FOR
NEXT J%
IF COUNT% = 0 THEN RETURN
IF CONSTEL$ = "DIP" THEN CONSTEL$ = "UMA"
PTR% = 4
GOSUB KILLCURSOR
DRAWCONST1:
K$ = MID$(LINNAME$(COUNT%), PTR%, 1)
IF K$ = "." THEN GOSUB DRAWCURSOR: RETURN
LOCNAME$ = MID$(LINNAME$(COUNT%), PTR% + 1, 3) + CONSTEL$
IF LOCNAME$ = "PEGPEG" THEN LOCNAME$ = "ALPAND": REM Note special treatment
IF LOCNAME$ = "LACLAC" THEN LOCNAME$ = "HR8485"
STARNUM% = 0
FOR K% = 1 TO NUM%
IF STARABBR$(K%) = LOCNAME$ THEN STARNUM% = K%: EXIT FOR
NEXT K%
IF STARNUM% = 0 THEN GOTO DRAWCONST2
IF XCOORD%(STARNUM%) < 0 THEN GOTO DRAWCONST2
IF XPOINT1% < 0 THEN
XPOINT1% = XCOORD%(STARNUM%)
YPOINT1% = YCOORD%(STARNUM%)
ELSE
XPOINT2% = XCOORD%(STARNUM%)
YPOINT2% = YCOORD%(STARNUM%)
GOSUB PLOTLINE
XPOINT1% = XCOORD%(STARNUM%)
YPOINT1% = YCOORD%(STARNUM%)
IF K$ = "=" THEN XPOINT1% = -1
END IF
DRAWCONST2:
PTR% = PTR% + 4
GOTO DRAWCONST1

' ---- DRAW CURSOR SUBROUTINE -----------------------

DRAWCURSOR:
IF MOUSEFLAG% = 1 AND MOUSEON% = 0 THEN
M1% = 1
CALL MOUSE(M1%, M2%, M3%, M4%)
MOUSEON% = 1
M1% = 4
M3% = XC%
M4% = YC%
CALL MOUSE(M1%, M2%, M3%, M4%)
END IF
IF MOUSEFLAG% = 0 THEN
FOR N% = 1 TO 11
X% = XC% + N% - 6
CCOLOR%(N%) = POINT(X%, YC%)
IF N% <> 6 THEN PSET (X%, YC%), 12
Y% = YC% + N% - 6
CCOLOR%(11 + N%) = POINT(XC%, Y%)
IF N% <> 6 THEN PSET (XC%, Y%), 12
NEXT N%
END IF
RETURN

' ---- KILL CURSOR SUBROUTINE ------------------------

KILLCURSOR:
IF MOUSEFLAG% = 1 AND MOUSEON% = 1 THEN
M1% = 2
CALL MOUSE(M1%, M2%, M3%, M4%)
MOUSEON% = 0
END IF
IF MOUSEFLAG% = 0 THEN
FOR N% = 1 TO 11
X% = XC% + N% - 6
PSET (X%, YC%), CCOLOR%(N%)
Y% = YC% + N% - 6
PSET (XC%, Y%), CCOLOR%(11 + N%)
NEXT N%
END IF
RETURN

' ---- SET/SHOW CURSOR PAD MODE (PAN or CURSOR) -------

CURSORMODE:
CFLAG% = -CFLAG%: REM Switch the flag
SHOWMODE:
LOCATE LASTLINE%, 65, 0
COLOR 2
PRINT USING "####"; PLOTTED%;
COLOR 7
PRINT " ";
PRINT USING "###"; WID;
PRINT "ø";
IF LDRAW% = -1 THEN
PRINT " ";
ELSE
COLOR 4
PRINT CHR$(18);
END IF
IF CFLAG% = 1 THEN
COLOR 2
PRINT "CURSOR";
ELSE
COLOR 6
IF MOUSEFLAG% = 0 THEN
PRINT "PAN ";
ELSE
PRINT "PAN";
COLOR 10
PRINT " ";
END IF
END IF
COLOR 7
RETURN

'---- CLEAR LAST LINE OF SCREEN -----------------------

ERASELAST:
LOCATE LASTLINE%, 1, 0
PRINT SPACE$(62);
LOCATE LASTLINE%, 1, 0
COLOR 7
RETURN

'---- DISPLAY PROGRAM NAME -------------------------------

PROGNAME:
GOSUB KILLCURSOR
LOCATE 5, ((71 - LEN(PROG$) - LEN(MACH$)) / 2), 0
COLOR 10
PRINT PROG$;
COLOR 14
PRINT " for the " + MACH$
COLOR 7
LOCATE 7, ((80 - LEN(AUTHOR$)) / 2), 0
PRINT AUTHOR$
LOCATE 9, ((80 - LEN(ORIGINAL$)) / 2), 0
PRINT ORIGINAL$
IF FIRST% = 1 THEN
MESSAGE$ = "Constellation Ursa Major"
LOCATE 22, ((80 - LEN(MESSAGE$)) / 2 - 5), 0
COLOR 6
PRINT MESSAGE$;
COLOR 7
END IF
LOCATE 40, 18, 0
COLOR 2
PRINT PROG$ + " plots a stereographic map of the sky"
LOCATE 41, 27, 0
PRINT "using an ASCII star database";
LOCATE 42, 23, 0
PRINT "for the region and field you select."
GOSUB ERASELAST
IF FIRST% = 0 THEN GOTO FCOORD
COLOR 4
LOCATE 47, 33, 0
PRINT "Press F1 for HELP";
COLOR 9
LOCATE LASTLINE%, 50, 0
PRINT "Version "; VERSION$;
GOSUB DRAWCURSOR

FCOORD:
LOCATE LASTLINE%, 1, 0
COLOR 6
PRINT "Current coordinates:";
SCOORD:
COLOR 6
PRINT " RA=";
COLOR 14
RAH = INT(RA0)
PRINT USING "##"; RAH;
COLOR 6
PRINT "h";
COLOR 14
RAM = INT((RA0 - RAH) * 60 + .5)
PRINT USING "##"; RAM;
COLOR 6
PRINT "' DEC=";
COLOR 14
DECD = INT(DEC0)
PRINT USING "###"; DECD;
COLOR 6
PRINT "ø";
COLOR 14
DECM = INT((DEC0 - DECD) * 60 + .5)
PRINT USING "##"; DECM;
COLOR 6
PRINT "'";
RETURN

'---- SHOW NAMES OF CONSTELLATIONS IN COLOR ---------------

SHOWCOLOR:
LOCATE LASTLINE%, 41, 0
FOR K% = 1 TO 6
COLOR 15 - K%
PRINT CONCOLOR$(K%); " ";
NEXT
RETURN

'---- LOAD STAR ARRAYS SUBROUTINE -------------------------

LOADSTARS:
COLOR 15
MESSAGE$ = "Loading VGASTARS data files ... PLEASE WAIT"
LOCATE 5, ((80 - LEN(MESSAGE$)) / 2), 0
PRINT MESSAGE$;
PRINT

'First check if MOUSE driver is present
MOUSEFLAG% = 0
DEF SEG = 0
MSEG = 256 * PEEK(51 * 4 + 3) + PEEK(51 * 4 + 2)
MOUSEVAL = 256 * PEEK(51 * 4 + 1) + PEEK(51 * 4) + 2
IF MSEG OR (MOUSEVAL - 2) THEN GOTO CHECKM2 ELSE GOTO CHECKM3
CHECKM2:
DEF SEG = MSEG
IF PEEK(MOUSEVAL - 2) = 207 THEN GOTO CHECKM3: '207 is IRET
MOUSEFLAG% = 1
CHECKM3:
DEF SEG
IF MOUSEFLAG% = 1 THEN
M1% = 0
CALL MOUSE(M1%, M2%, M3%, M4%)
IF M1% = 0 THEN
MOUSEFLAG% = 0
ELSE
M1% = 1
CALL MOUSE(M1%, M2%, M3%, M4%)
MOUSEON% = 1
'M1%=14
'CALL MOUSE(M1%,M2%,M3%,M4%)
END IF
END IF
CHECKM4:
IF MOUSEFLAG% = 1 THEN
COLOR 10
MESSAGE$ = "Mouse Driver is present"
MOUSEON% = 0
ELSE
COLOR 12
MESSAGE$ = "Mouse Driver NOT found (or disabled)"
MOUSEON% = -1
END IF
PRINT : PRINT TAB((80 - LEN(MESSAGE$)) / 2); MESSAGE$: PRINT : PRINT

LOADSTARS1:
COLOR 4
MESSAGE$ = "Loading Star Data into Memory from " + DTBS$

PRINT TAB((80 - LEN(MESSAGE$)) / 2); MESSAGE$
OPEN DTBS$ FOR INPUT AS #1: K% = 1
READNEXT:
IF EOF(1) THEN CLOSE : NUM% = K% - 1: ARLD = -1: GOTO LOADNAMES
INPUT #1, N$
IF LEN(N$) <> 28 THEN
COLOR 12
PRINT DTBS$; ": DATA FORMAT ERROR IN LINE"; K% + 1
READERROR:
K$ = INKEY$: IF LEN(K$) = 0 THEN GOTO READERROR
COLOR 7
GOTO READNEXT
END IF
STARABBR$(K%) = MID$(N$, 1, 6)
RA = VAL(MID$(N$, 8, 2)) + VAL(MID$(N$, 10, 3)) / 600
DSGN$ = MID$(N$, 13, 1): IF DSGN$ = "-" THEN DSGN = -1 ELSE DSGN = 1
DEC = DSGN * (VAL(MID$(N$, 14, 2)) + VAL(MID$(N$, 16, 2)) / 60)
IMAG% = VAL(MID$(N$, 19, 4)) * 10
RA(K%) = RA * .261845: DEC(K%) = DEC * RADIAN: MAG%(K%) = IMAG%
MARK%(K%) = 15
K% = K% + 1
GOTO READNEXT

LOADNAMES:
COLOR 4
MESSAGE$ = "Loading Star Names into Memory from " + DTBN$
PRINT : PRINT TAB((80 - LEN(MESSAGE$)) / 2); MESSAGE$
COLOR 7
OPEN DTBN$ FOR INPUT AS #1: K% = 1
READNEXT1:

IF EOF(1) THEN CLOSE : STARNAME% = K% - 1: GOTO LOADCONS
INPUT #1, N$
STARNAME$(K%) = N$
K% = K% + 1
GOTO READNEXT1

LOADCONS:
COLOR 4
MESSAGE$ = "Loading Constellation Names into Memory from " + DTBC$
PRINT : PRINT TAB((80 - LEN(MESSAGE$)) / 2); MESSAGE$
COLOR 7
OPEN DTBC$ FOR INPUT AS #1: K% = 1
READNEXT2:
IF EOF(1) THEN CLOSE : CONNAME% = K% - 1: GOTO LOADLINES
INPUT #1, N$
CONNAME$(K%) = N$
K% = K% + 1
GOTO READNEXT2

LOADLINES:
COLOR 4
MESSAGE$ = "Loading Constellation Lines into Memory from " + DTBL$
PRINT : PRINT TAB((80 - LEN(MESSAGE$)) / 2); MESSAGE$
PRINT : PRINT
COLOR 7
LINNAME$(1) = "DIP:ALP-BET-GAM-DEL-EPS-ZET-ETA."
LINNAME% = 1

OPEN DTBL$ FOR INPUT AS #1: K% = 2
READNEXT3:
IF EOF(1) THEN CLOSE : LINNAME% = K%: RETURN
INPUT #1, N$
LINNAME$(K%) = N$
K% = K% + 1
GOTO READNEXT3

'---- HELP SCREEN -----------------------------------------

HELP1:
GOSUB KILLCURSOR
CLS
LOCATE 1, 1, 0
PRINT : PRINT
COLOR 4: PRINT "HELP";
COLOR 7: PRINT "---------";
COLOR 6: PRINT "F1 ";

IF MOUSEFLAG% = 1 THEN
COLOR 2: PRINT "F2";
COLOR 7: PRINT "--";
COLOR 2: PRINT "MOUSE";
COLOR 7: PRINT " off"
ELSE
PRINT "F2";
COLOR 7: PRINT "--";
COLOR 2: PRINT "CURSOR";
COLOR 7: PRINT "/";
COLOR 6: PRINT "PAN"
END IF

COLOR 12: PRINT "Å";
COLOR 7: PRINT " Coords-----";
COLOR 6: PRINT "F3 F4";
COLOR 7: PRINT "--";
COLOR 9: PRINT "GRID";
COLOR 7: PRINT " on/off"
PRINT "New Coords---";
COLOR 6: PRINT "F5 F6";
COLOR 7: PRINT "--";
COLOR 8: PRINT "DRAW "; CHR$(18);
COLOR 7: PRINT " on/off"
COLOR 7: PRINT "Color Const--";
COLOR 6: PRINT "F7 F8";
COLOR 7: PRINT "--Locate ";
COLOR 2: PRINT "STAR"
COLOR 7: PRINT "Add'l Const--";
COLOR 6: PRINT "F9 F10";
COLOR 7: PRINT "--Plot Const"
PRINT
COLOR 6: PRINT " Fn";
COLOR 7: PRINT " = Normal Function Key"
IF MOUSEFLAG% = 1 THEN
COLOR 2: PRINT " Fn";
COLOR 7: PRINT " = ";
COLOR 2: PRINT "ALT";
COLOR 7: PRINT " + Function Key"
END IF

LINE (305, 4)-(606, 42), 2, B
IF MOUSEFLAG% = 0 THEN
LOCATE 2, 40, 0
COLOR 7: PRINT "In ";
COLOR 2: PRINT "CURSOR ";
COLOR 7: PRINT "mode, the arrow keys move"
LOCATE 3, 40, 0
PRINT "the crosshair around the screen and"
LOCATE 4, 40, 0
PRINT "the HOME key returns the crosshair"
LOCATE 5, 40, 0
PRINT "to its original position."
ELSE
LOCATE 2, 40, 0
COLOR 7: PRINT "When a ";
COLOR 2: PRINT "MOUSE";
COLOR 7: PRINT " is installed, the mouse"
LOCATE 3, 40, 0
PRINT "cursor may be freely moved about the"
LOCATE 4, 40, 0
PRINT "screen. The ";
COLOR 2: PRINT "LEFT";
COLOR 7: PRINT " button is used to"
LOCATE 5, 40, 0
PRINT "invoke the FINDSTAR function."
END IF

LINE (305, 45)-(606, 82), 6, B
LOCATE 7, 40, 0
COLOR 7: PRINT "In";
LOCATE 7, 43, 0
COLOR 6: PRINT "PAN";
LOCATE 7, 47, 0
COLOR 7: PRINT "mode, the arrow keys move the"
LOCATE 8, 40, 0
PRINT "field of stars in the direction of"
LOCATE 9, 40, 0
PRINT "the key. PgUp zooms IN, PgDn zooms"
LOCATE 10, 40, 0
PRINT "OUT. The screen is always redrawn."

LOCATE 12, 1, 0
COLOR 6: PRINT "F7 ";
COLOR 7: PRINT "Add ";
COLOR 5: PRINT "next";
COLOR 7: PRINT " color to requested constellation, repaint the screen."
COLOR 6: PRINT "F8 ";
COLOR 7: PRINT "Locate a ";
COLOR 2: PRINT "STAR ";
COLOR 7: PRINT "by 6-letter name, color it ";
COLOR 2: PRINT "GREEN";
COLOR 7: PRINT ", and redraw screen."
COLOR 6: PRINT "F9 ";
COLOR 7: PRINT "Add ";
COLOR 5: PRINT "next";
COLOR 7: PRINT " color to requested constellation, redraw screen."
COLOR 6: PRINT "F10 ";
COLOR 7: PRINT "Clear all colors and plot requested constellation in ";
COLOR 6: PRINT "YELLOW";
COLOR 7: PRINT "."

COLOR 6: PRINT "ESC ";
COLOR 7: PRINT "Cancel STAR or CONSTALLATION lookup ";
COLOR 4: PRINT "(F7-F8-F9-F10)"
PRINT
COLOR 6: PRINT "Enter ";
COLOR 7: PRINT "Repaint the screen (and the coordinate ";
COLOR 9: PRINT "GRID";
COLOR 7: PRINT ", if enabled)."
PRINT
COLOR 6: PRINT "Del ";
COLOR 7: PRINT "Change minimum magnitude stars displayed. ";
COLOR 2: PRINT "(>5,>4,>3,>5...)"
PRINT
PRINT " Sample star magnitudes displayed:"
PRINT
PRINT " >6.0 >5.0 >4.0 >3.0 >2.3 >1.5 >0.5";
PRINT

'---- Display sample stars of each magnitude

IMARK% = 15
Y% = (CSRLIN - 1) * 8 - 5
X% = 94
RESTORE
FOR N% = 1 TO 7
READ IMAG%
GOSUB PLOTSTAR
X% = X% + 64
NEXT: PRINT
DATA 51,41,31,24,16,6,1

'----

'COLOR 6: PRINT "M ";
'COLOR 7: PRINT "Automatic time motion, 15 minute intervals. SPACE BAR";
' PRINT " cancels."
PRINT
COLOR 6: PRINT "S ";
COLOR 7: PRINT "Identify the ";
COLOR 2: PRINT "STAR ";
COLOR 7: PRINT "nearest to the crosshair and color it ";
COLOR 2: PRINT "GREEN";
COLOR 7: PRINT ". In the"
COLOR 4: PRINT " DRAW "; CHR$(18);
COLOR 7: PRINT " mode, also marks line segment end point.";
COLOR 2: PRINT " (Same as LEFT MOUSE"
PRINT " BUTTON if mouse is enabled.)"
PRINT
COLOR 6: PRINT "R ";
COLOR 7: PRINT "Replot the screen using the last star coordinates."
PRINT
COLOR 6: PRINT "Z ";
COLOR 7: PRINT "Clear all star colors. ";
COLOR 6: PRINT "H ";
COLOR 7: PRINT "Show visual horizon ";
COLOR 4: PRINT "(if W>=180ø)"
PRINT
COLOR 12: PRINT "Q Quit ";
COLOR 7: PRINT "program VGASTARS. ";
COLOR 6: PRINT "W ";
COLOR 7: PRINT "Set new field width."

COL% = 4
N% = 0
HELP1K:
N% = N% + 1: IF N% < 3000 THEN GOTO HELP2K
LOCATE LASTLINE%, 1, 1
COLOR COL%: PRINT " Press any key to continue";
LINE (4, (LASTLINE% - 1) * 8 - 2)-(208, (LASTLINE% - 1) * 8 + 10), 4, B
N% = 0
IF COL% = 4 THEN COL% = 12 ELSE COL% = 4
HELP2K:
K$ = INKEY$
IF LEN(K$) = 0 THEN GOTO HELP1K
GOTO REDRAW



  3 Responses to “Category : Printer + Display Graphics
Archive   : VGASTARS.ZIP
Filename : VGASTARS.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/