home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1984-11-12 | 15.2 KB | 457 lines |
- 10 ' STOCK/BOND DATA FILE BY EVELYN LEON. COPYRIGHT (C) 1984.
- 20 GOSUB 110 'TITLE
- 30 GOSUB 3330 'INIT
- 40 GOSUB 210 'MAIN SELECT
- 50 IF ESC.FLAG% THEN 2710 'END
- 60 GOSUB 560 'MAIN ACTION
- 70 IF ESC.FLAG% THEN ESC.FLAG%=0:GOTO 40 'BACK TO MAIN SELECT
- 80 GOSUB 1860 'OUTPUT
- 90 GOTO 60
- 100 '
- 101 'INITIALIZATION
- 102 '
- 110 ON ERROR GOTO 3260
- 111 DEF FNEXTRACT$(X$,N%) = MID$(X$,((N%-1)*4)+1,4)
- 112 DEF FNSTRIP$(X!)= RIGHT$(STR$(X!),LEN(STR$(X!))-1)
- 114 KEY OFF:FOR X = 1 TO 10:KEY X, "" :NEXT
- 116 SCREEN 0,0,0:WIDTH 80:COLOR 7,0,0
- 118 ESC$ = CHR$(27) : LASTPG$ =CHR$(75) : NEXTPG$ = CHR$(77)
- 120 N = 1:OPTION BASE 1
- 122 DIM BOND.IND$(15), BOND.FORM$(15), STOCK.IND$(15), STOCK.FORM$(15), IND$(15), IFORM$(15), VAL1(220), VAL2(220), DAY$(220)
- 126 LN = 0: COL = 0: TOTCH = 0: PRT = 0: F$ = "": P$ = "": PRTSW = 0
- 130 BR = 0: RC = 0: VERT$ = CHR$(179): HORI$ = CHR$(205)
- 132 ULC$ = CHR$(213) : URC$ = CHR$(184) : LRC$ = CHR$(190) : LLC$ = CHR$(212)
- 134 START.WIPE = 0 : END.WIPE = 0
- 140 STOCK.IND$(1)= "DJ INDUSTRIAL AVERAGE"
- 141 STOCK.IND$(2)= "S & P 500"
- 142 STOCK.IND$(3)= "S & P 500 FUTURE"
- 143 STOCK.IND$(4)= "NYSE COMPOSITE"
- 144 STOCK.IND$(5)= "NYSE COMPOSITE FUTURE"
- 145 STOCK.IND$(6)= "VALUE LINE"
- 146 STOCK.IND$(7)= "VALUE LINE FUTURE"
- 147 STOCK.IND$(8)= "NYSE ISSUES ADVANCING"
- 148 STOCK.IND$(9)= "NYSE ISSUES DECLINING"
- 149 STOCK.IND$(10)="NYSE ISSUES UNCHANGED"
- 150 STOCK.IND$(11)="TOTAL NYSE VOLUME"
- 151 STOCK.IND$(12)="ADVANCING NYSE VOLUME"
- 152 STOCK.IND$(13)="DECLINING NYSE VOLUME"
- 153 STOCK.IND$(14)="CBOE CALL VOLUME"
- 154 STOCK.IND$(15)="CBOE PUT VOLUME"
- 155 BOND.IND$(1)= "DISCOUNT RATE"
- 156 BOND.IND$(2)= "FED FUNDS RATE"
- 157 BOND.IND$(3)= "COMMERCIAL PAPER"
- 158 BOND.IND$(4)= "3 MONTH T-BILL"
- 159 BOND.IND$(5)= "6 MONTH T-BILL"
- 160 BOND.IND$(6)= "12 MONTH T-BILL"
- 161 BOND.IND$(7)= "3 YEAR T-NOTE"
- 162 BOND.IND$(8)= "5 YEAR T-NOTE"
- 163 BOND.IND$(9)= "7 YEAR T-NOTE"
- 164 BOND.IND$(10)= "10 YEAR T-NOTE"
- 165 BOND.IND$(11)= "20 YEAR T-NOTE"
- 166 BOND.IND$(12)= "30 YEAR T-NOTE"
- 167 BOND.IND$(13)= "LONG MUNI BOND RATE"
- 168 BOND.IND$(14)= "M-1 MONEY SUPPLY "
- 169 BOND.IND$(15)= "NET FREE RESERVES"
- 170 STOCK.FORM$(1)= "####.##"
- 171 STOCK.FORM$(2)= "###.##"
- 172 STOCK.FORM$(3)= "###.##"
- 173 STOCK.FORM$(4)= "###.##"
- 174 STOCK.FORM$(5)= "###.##"
- 175 STOCK.FORM$(6)= "###.##"
- 176 STOCK.FORM$(7)= "###.##"
- 177 STOCK.FORM$(8)= "####,."
- 178 STOCK.FORM$(9)= "####,."
- 179 STOCK.FORM$(10)="####,."
- 180 STOCK.FORM$(11)="######,."
- 181 STOCK.FORM$(12)="######,."
- 182 STOCK.FORM$(13)="######,."
- 183 STOCK.FORM$(14)="####,."
- 184 STOCK.FORM$(15)="####,."
- 185 BOND.FORM$(1)= "##.##"
- 186 BOND.FORM$(2)= "##.##"
- 187 BOND.FORM$(3)= "##.##"
- 188 BOND.FORM$(4)= "##.##"
- 189 BOND.FORM$(5)= "##.##"
- 190 BOND.FORM$(6)= "##.##"
- 191 BOND.FORM$(7)= "##.##"
- 192 BOND.FORM$(8)= "##.##"
- 193 BOND.FORM$(9)= "##.##"
- 194 BOND.FORM$(10)= "##.##"
- 195 BOND.FORM$(11)= "##.##"
- 196 BOND.FORM$(12)= "##.##"
- 197 BOND.FORM$(13)= "##.##"
- 198 BOND.FORM$(14)= "###.#"
- 199 BOND.FORM$(15)= "+####,."
- 200 RETURN
- 201 '
- 202 ' MAIN MENU
- 203 '
- 210 IF BOX.DONE%=0 THEN CLS:GOSUB 42000:GOTO 260
- 220 LOCATE 11,35:PRINT SPACE$(15):LOCATE 14,29:PRINT SPACE$(30)
- 260 LOCATE 10,30:PRINT "VIEW:"
- 270 LOCATE 12,35:PRINT "(S)TOCK DATA"
- 280 LOCATE 13,35:PRINT "(B)OND DATA"
- 290 LOCATE 15,25:PRINT "ENTER CHOICE (<ESC> TO EXIT):"
- 300 LN = 15 : COL = 55 : TOTCH = 1 : PRT = 1 : GOSUB 3070 : A$ = P$'INKEY
- 310 IF ESC.FLAG% THEN GOTO 2710
- 320 IF A$ = "S" OR A$ = "s" THEN BDAT = 0: GOTO 350
- 330 IF A$ = "B" OR A$ = "b" THEN BDAT = 1: GOTO 350
- 340 BEEP:LOCATE 7,33: PRINT " " :GOTO 300
- 350 CLOSE #1:IF A$="S" OR A$="s" THEN GOSUB 410 ELSE GOSUB 460
- 360 RETURN
- 400 '
- 401 ' DATA FILE OPEN
- 402 '
- 410 REC.LEN% = 60 : OPEN "R",1,"STOCK.DAT",REC.LEN%
- 420 FIELD #1, 4 AS START.DAT$, 4 AS LAST.DAT$, 4 AS LAST.REC$, REC.LEN%-12 AS REST$ : GOSUB 510
- 430 FIELD #1, REC.LEN% AS RECORD$
- 440 RETURN
- 460 REC.LEN% = 64 : OPEN "R",1,"BOND.DAT",REC.LEN%
- 470 FIELD #1, 4 AS START.DAT$, 4 AS LAST.DAT$, 4 AS LAST.REC$, REC.LEN% - 12 AS REST$ : GOSUB 510
- 480 FIELD #1, 4 AS DAT.REC$, REC.LEN%-4 AS RECORD$
- 490 RETURN
- 500 '
- 501 ' READ DATA FILE CONTROL RECORD
- 502 '
- 510 GET #1,1 : START.DAT% = CVS(START.DAT$) : LAST.DAT% = CVS(LAST.DAT$): LAST.REC% = CVS(LAST.REC$)
- 520 DT = START.DAT%: GOSUB 51490: START.PRN$ = DT.PRN$
- 530 IF LAST.DAT% <> 0 THEN DT = LAST.DAT%:GOSUB 51490: LAST.PRN$ = DT.PRN$
- 540 SCRATCH! = FRE("")
- 545 RETURN
- 550 '
- 551 ' MAIN ACTION
- 552 '
- 560 CLS:BOX.DONE%=0
- 580 COLOR 0,7
- 590 LN = 1: COL = 2 : BR = 12 : RC = 79
- 600 GOSUB 41000 'DRAW BOX
- 610 GOSUB 990 'DISPLAY
- 620 GOSUB 1150 'GET SPEC
- 630 IF ESC.FLAG% THEN RETURN
- 640 GOSUB 1610 'GET DATA
- 650 IF OKDAT THEN RETURN ELSE GOTO 620
- 900 '
- 901 ' DISPLAY INDICATORS
- 902 '
- 990 FIRST.COL=5:SECOND.COL=46
- 1010 FOR X=1 TO 15
- 1020 IF BDAT=1 THEN IND$(X)=BOND.IND$(X):IFORM$(X)=BOND.FORM$(X) ELSE IND$(X)=STOCK.IND$(X):IFORM$(X)=STOCK.FORM$(X)
- 1030 NEXT
- 1050 COLOR 7,0:FOR X=3 TO 9
- 1060 LOCATE X,FIRST.COL:PRINT "V"+RIGHT$(STR$(X-2),1)+". "+IND$(X-2)
- 1080 NEXT
- 1090 FOR X=3 TO 10
- 1100 LOCATE X,SECOND.COL:IF X+5<10 THEN PRINT "V"+RIGHT$(STR$(X+5),1)+". "+IND$(X+5) ELSE PRINT "V"+RIGHT$(STR$(X+5),2)+". "+IND$(X+5)
- 1110 NEXT
- 1130 RETURN
- 1140 '
- 1141 ' GET SELECTION SPECS
- 1142 '
- 1150 LOCATE 13,30: PRINT "Selection Expressions:"
- 1155 LOCATE 14,33: PRINT "Vx"
- 1160 LOCATE 15,33: PRINT "Vx <,>,= VALUE"
- 1170 LOCATE 16,33: PRINT "Vx <,>,= Vy"
- 1180 LOCATE 18,5: PRINT "ENTER SELECTION EXPRESSION (<ESC> TO EXIT): ";
- 1190 LOCATE 18,49: PRINT SPACE$(10);:LN = 18 : COL = 49 : TOTCH = 12 : PRT = 1 : GOSUB 3070 : IF ESC.FLAG% THEN RETURN
- 1200 LEXPR$ = P$: IF LEXPR$="" THEN GOTO 1190 ELSE GOSUB 1410
- 1205 IF EXTYPE = 0 THEN LOCATE 18,60,0:PRINT "Invalid Expression";:GOSUB 3040:LOCATE 18,60:PRINT SPACE$(18);:GOTO 1190
- 1210 LOCATE 20,5: PRINT "START DATE (";START.PRN$;" or later):";
- 1220 LOCATE 20,37: PRINT SPACE$(10);:LN = 20 : COL = 37 : TOTCH = 9 : PRT = 1 : GOSUB 3070 : IF ESC.FLAG% THEN LOCATE 20,1:PRINT SPACE$(60);:GOTO 1190
- 1230 DAT$ = P$: IF DAT$="" THEN GOTO 1220 ELSE GOSUB 1510
- 1240 IF DT.FLAG% THEN LOCATE 20,50,0:PRINT "Invalid Date";:IF DT.FLAG%=1 THEN PRINT " - Out of Range";
- 1245 IF DT.FLAG% THEN GOSUB 3040:LOCATE 20,50:PRINT SPACE$(28);:GOTO 1220
- 1250 SDATE=DT.INT%
- 1260 LOCATE 21,5: PRINT "END DATE (";LAST.PRN$;" or earlier):";
- 1270 LOCATE 21,37: PRINT SPACE$(10);:LN = 21 : COL = 37 : TOTCH = 9 : PRT = 1 : GOSUB 3070 : IF ESC.FLAG% THEN LOCATE 21,1:PRINT SPACE$(60);:GOTO 1220
- 1280 DAT$ = P$: IF DAT$="" THEN GOTO 1270 ELSE GOSUB 1510
- 1290 IF DT.FLAG% THEN LOCATE 21,50,0:PRINT "Invalid Date";:IF DT.FLAG%=1 THEN PRINT " - Out of Range";
- 1295 IF DT.FLAG% THEN GOSUB 3040:LOCATE 21,50:PRINT SPACE$(28);:GOTO 1270
- 1300 EDATE=DT.INT%
- 1305 IF SDATE>EDATE THEN LOCATE 22,30,0:PRINT "End Date preceeds Start Date";:GOSUB 3040:LOCATE 22,30:PRINT SPACE$(40);:LOCATE 21,2:PRINT SPACE$(70);:GOTO 1220
- 1310 LOCATE 23,5: PRINT "OUTPUT TO SCREEN OR PRINTER (S/P): ";
- 1320 LOCATE 23,40: PRINT SPACE$(5);:LN = 23 : COL = 40 : TOTCH = 1 : PRT = 1 : GOSUB 3070 : IF ESC.FLAG% THEN LOCATE 23,10:PRINT SPACE$(60);:GOTO 1270
- 1330 IF P$ = "P" OR P$ = "p" THEN PRTSW = -1: GOTO 1360
- 1340 IF P$ = "S" OR P$ = "s" THEN PRTSW = 0: GOTO 1360
- 1350 BEEP:GOTO 1320
- 1360 LOCATE 24,20:PRINT "OK TO PROCEED (Y/N)? ";
- 1370 LOCATE 24,41:PRINT SPACE$(1);:LN = 24 : COL = 41 : TOTCH = 1 : PRT = 1 : GOSUB 3070 : IF ESC.FLAG% THEN LOCATE 24,20:PRINT SPACE$(21);:GOTO 1320
- 1380 IF P$ = "Y" OR P$ = "y" THEN GOTO 1410
- 1385 IF P$ = "N" OR P$ = "n" THEN GOTO 1190
- 1390 BEEP:GOTO 1320
- 1395 RETURN
- 1400 '
- 1401 ' EXPRESSION VALIDATION
- 1402 '
- 1410 EXTYPE = 0:OPER$ = ""
- 1415 PB$=LEFT$(LEXPR$,1):IF PB$<>"V" AND PB$<>"v" THEN RETURN
- 1420 FOR I%=0 TO 2:K%=INSTR(LEXPR$,CHR$(60+I%)):IF K%<>0 THEN I%=2
- 1425 NEXT I%:IF K%=0 THEN ARG1$=LEXPR$:GOTO 1435
- 1430 ARG1$=LEFT$(LEXPR$,K%-1):OPER$=MID$(LEXPR$,K%,1):ARG2$=RIGHT$(LEXPR$,LEN(LEXPR$)-K%)
- 1435 EXTYPE=1:EXBUF$=RIGHT$(ARG1$,LEN(ARG1$)-1):GOSUB 1492:IF EXTYPE=0 THEN RETURN
- 1440 IND1=VAL(EXBUF$):IF OPER$="" THEN RETURN
- 1445 EXTYPE=3:PB$=LEFT$(ARG2$,1)
- 1450 IF PB$="V" OR PB$="v" THEN EXBUF$=RIGHT$(ARG2$,LEN(ARG2$)-1):GOSUB 1492:IF EXTYPE=0 THEN RETURN ELSE IND2=VAL(EXBUF$):RETURN
- 1455 EXTYPE=2:PT.FLAG%=0:PB$=LEFT$(ARG2$,1):EXBUF$=""
- 1460 IF PB$="+" OR PB$="-" THEN EXBUF$=PB$:ARG2$=RIGHT$(ARG2$,LEN(ARG2$)-1)
- 1465 FOR I%=1 TO LEN(ARG2$):PB$=MID$(ARG2$,I%,1)
- 1470 IF PB$="." THEN IF PT.FLAG%=1 THEN EXTYPE=0:RETURN ELSE PT.FLAG%=1:GOTO 1480
- 1475 IF PB$<"0" OR PB$>"9" THEN EXTYPE=0:RETURN
- 1480 EXBUF$=EXBUF$+PB$:NEXT I%
- 1490 VALUE=VAL(EXBUF$):RETURN
- 1491 '
- 1492 L%=LEN(EXBUF$):IF L%<1 OR L%>2 THEN EXTYPE=0:RETURN
- 1494 IF L%=1 THEN IF EXBUF$>="1" AND EXBUF$<="9" THEN RETURN ELSE EXTYPE=0:RETURN
- 1496 IF L%=2 THEN IF LEFT$(EXBUF$,1)<>"1" OR RIGHT$(EXBUF$,1)<"0" OR RIGHT$(EXBUF$,1)>"5" THEN EXTYPE=0
- 1498 RETURN
- 1500 '
- 1501 ' DATE VALIDATION
- 1502 '
- 1510 GOSUB 51050
- 1520 IF DT.INT%<START.DAT% OR DT.INT%>LAST.DAT% THEN DT.FLAG%=1
- 1530 RETURN
- 1600 '
- 1601 ' DATA RETRIEVAL
- 1602 '
- 1610 OKDAT = 0:CNT=0:START.WIPE=13:END.WIPE=24:GOSUB 3010:LOCATE 18,35:COLOR 31:PRINT "WORKING":COLOR 7,0
- 1615 IF BDAT THEN GOSUB 1660 ELSE SREC = SDATE-START.DAT%+2:EREC = EDATE-START.DAT%+2
- 1620 FOR I%=SREC TO EREC:GET #1,I%
- 1625 IF EXTYPE = 1 THEN GOSUB 1710
- 1630 IF EXTYPE = 2 THEN VAL2 = VALUE:GOSUB 1740
- 1635 IF EXTYPE = 3 THEN GOSUB 1770
- 1640 IF CNT = 221 THEN I%=EREC
- 1645 NEXT I%
- 1650 IF CNT>220 THEN LOCATE 21,20:PRINT "Too many days requested.":LOCATE 22,20:PRINT "Break your request into shorter timeframes.":GOSUB 3040:RETURN
- 1655 OKDAT = 1:RETURN
- 1657 '
- 1660 TST.DAT%=SDATE:REC.NUM%=1
- 1662 GOSUB 1680:SREC=REC.NUM%
- 1664 TST.DAT%=EDATE:REC.NUM%=REC.NUM%-1
- 1666 GOSUB 1680:EREC=REC.NUM%:RETURN
- 1668 '
- 1680 MATCH.FLAG%=0
- 1682 WHILE NOT MATCH.FLAG%
- 1684 REC.NUM%=REC.NUM%+1:GET #1,REC.NUM%:TDATE%=CVS(DAT.REC$)
- 1686 IF TDATE%>=TST.DAT% THEN MATCH.FLAG%=-1
- 1688 WEND
- 1690 RETURN
- 1700 '
- 1701 ' RETRIEVAL BY EXPRESSION TYPE
- 1702 '
- 1710 TVAL=CVS(MID$(RECORD$,(IND1*4)-3,4)):IF TVAL=0 THEN RETURN
- 1715 CNT=CNT+1:IF CNT>220 THEN RETURN
- 1720 VAL1(CNT)=TVAL:GOSUB 1800:RETURN
- 1730 '
- 1740 TVAL=CVS(MID$(RECORD$,(IND1*4)-3,4)):IF TVAL=0 THEN RETURN
- 1745 VAL1=TVAL:GOSUB 1810:IF NOGO.FLAG% THEN RETURN
- 1750 CNT=CNT+1:IF CNT>220 THEN RETURN
- 1755 VAL1(CNT)=VAL1:GOSUB 1800:RETURN
- 1760 '
- 1770 TVAL=CVS(MID$(RECORD$,(IND1*4)-3,4)):IF TVAL=0 THEN RETURN
- 1775 VAL1=TVAL
- 1780 TVAL=CVS(MID$(RECORD$,(IND2*4)-3,4)):IF TVAL=0 THEN RETURN
- 1785 VAL2=TVAL:GOSUB 1810:IF NOGO.FLAG% THEN RETURN
- 1790 CNT=CNT+1:IF CNT>220 THEN RETURN
- 1795 VAL1(CNT)=VAL1:VAL2(CNT)=VAL2:GOSUB 1800:RETURN
- 1797 '
- 1800 IF BDAT THEN DT=CVS(DAT.REC$) ELSE DT=I%+START.DAT%-2
- 1805 GOSUB 51490:DAY$(CNT)=DT.PRN$:RETURN
- 1807 '
- 1810 NOGO.FLAG%=1
- 1812 IF OPER$="<" AND VAL1 < VAL2 THEN NOGO.FLAG%=0:RETURN
- 1814 IF OPER$=">" AND VAL1 > VAL2 THEN NOGO.FLAG%=0:RETURN
- 1816 IF OPER$="=" AND ABS(VAL1-VAL2)<0.01 THEN NOGO.FLAG%=0
- 1818 RETURN
- 1850 '
- 1851 ' DATA OUTPUT
- 1852 '
- 1860 EXEXPR$=IND$(IND1)
- 1870 IF EXTYPE=2 THEN EXEXPR$=EXEXPR$+" "+OPER$+STR$(VALUE)
- 1880 IF EXTYPE=3 THEN EXEXPR$=EXEXPR$+" "+OPER$+" "+IND$(IND2)
- 1890 IF PRTSW THEN DISPLEN=56 ELSE DISPLEN=17
- 1900 NPGS=INT(CNT/DISPLEN)
- 1910 DT=SDATE:GOSUB 51490:SDATE$=DT.PRN$
- 1920 DT=EDATE:GOSUB 51490:EDATE$=DT.PRN$
- 1930 TSPAN$=SDATE$+"-"+EDATE$
- 1940 RJUST=79-LEN(EXEXPR$)-LEN(TSPAN$)-12
- 1943 P1=13+CINT(LEN(IND$(IND1))/3)
- 1945 IF EXTYPE=3 THEN P2=18+LEN(IND$(IND1))+CINT(LEN(IND$(IND2))/3)
- 1947 IF PRTSW THEN CLS:LOCATE 18,25,0:PRINT "PRESS <ESC> TO HALT PRINTING."
- 1950 IF PRTSW THEN OPEN "O",2,"LPT1:" ELSE OPEN "O",2,"SCRN:"
- 1960 PGCNT=1
- 1970 SLINE=((PGCNT-1)*DISPLEN)+1
- 1980 ELINE=PGCNT*DISPLEN:IF ELINE>CNT THEN ELINE=CNT
- 1990 IF NOT(PRTSW) THEN CLS
- 2000 GOSUB 2310
- 2010 IF ESC.FLAG% THEN ESC.FLAG%=0:CLOSE #2:RETURN
- 2020 IF PRTSW THEN PRINT #2,CHR$(12):PGCNT=PGCNT+1:IF PGCNT>NPGS+1 THEN CLOSE #2:RETURN ELSE GOTO 1970
- 2030 P$=INKEY$:IF P$="" THEN 2030
- 2040 P$=RIGHT$(P$,1):IF ASC(P$)=27 THEN CLOSE #2:RETURN
- 2050 IF ASC(P$)=75 THEN TPGCNT=PGCNT-1:IF TPGCNT>0 THEN PGCNT=TPGCNT:GOTO 1970 ELSE BEEP:GOTO 2030
- 2060 IF ASC(P$)=77 THEN TPGCNT=PGCNT+1:IF TPGCNT<NPGS+2 THEN PGCNT=TPGCNT:GOTO 1970 ELSE BEEP:GOTO 2030
- 2080 BEEP:GOTO 2030
- 2300 '
- 2301 ' OUTPUT A PAGE
- 2302 '
- 2310 ESC.FLAG%=0
- 2315 PRINT #2,EXEXPR$+SPACE$(5)+TSPAN$+SPACE$(RJUST)+"Page"+STR$(PGCNT)
- 2320 PRINT #2," "
- 2330 PRINT #2," DATE "+SPACE$(5)+IND$(IND1);
- 2340 IF EXTYPE=3 THEN PRINT #2,SPACE$(5)+IND$(IND2);
- 2350 PRINT #2," "
- 2360 PRINT #2,STRING$(8,"-")+SPACE$(5)+STRING$(LEN(IND$(IND1)),"-");
- 2370 IF EXTYPE=3 THEN PRINT #2,SPACE$(5)+STRING$(LEN(IND$(IND2)),"-");
- 2380 PRINT #2," "
- 2390 FOR I%=SLINE TO ELINE
- 2400 PRINT #2,DAY$(I%);TAB(P1);
- 2410 PRINT #2,USING IFORM$(IND1);VAL1(I%);
- 2420 IF EXTYPE=3 THEN PRINT #2,TAB(P2);:PRINT #2,USING IFORM$(IND2);VAL2(I%);
- 2430 PRINT #2," "
- 2440 P$=INKEY$:IF P$<>"" THEN IF ASC(P$)=27 THEN ESC.FLAG%=1:RETURN
- 2450 NEXT I%
- 2460 IF NOT(PRTSW) THEN PRINT #2," ":PRINT #2,"TYPE "+CHR$(26)+" FOR NEXT PAGE, "+CHR$(27)+" FOR PREVIOUS PAGE, OR <ESC> TO EXIT"
- 2470 RETURN
- 2700 '
- 2701 ' EXIT
- 2702 '
- 2710 CLS:ON ERROR GOTO 0
- 2720 KEY 1,"LIST" :KEY 2,"RUN" + CHR$(13) :KEY 3,"LOAD" + CHR$(34) :KEY 4,"SAVE"+ CHR$(34)
- 2730 KEY 5,"CONT" + CHR$(13) :KEY 6, CHR$(34) + "LPT1" + CHR$(34) + CHR$(13)
- 2740 KEY 7,"TRON" + CHR$(13) :KEY 8,"TROFF" + CHR$(13) :KEY 9,"KEY":
- 2750 KEY 10,"SCREEN 0,0,0"
- 2760 KEY ON
- 2770 END
- 3010 LOCATE ,,0: FOR X = START.WIPE TO END.WIPE 'WIPE
- 3015 LOCATE X,1: PRINT SPC(77);
- 3020 NEXT
- 3030 RETURN
- 3040 FOR X = 1 TO 1500:NEXT X:RETURN 'DELAY
- 3050 '
- 3051 ' INKEY ROUTINE
- 3052 '
- 3070 P$ = ""
- 3075 ESC.FLAG% = 0
- 3080 O = COL : N = COL : Z = 0
- 3090 IF Z = TOTCH THEN RETURN
- 3100 LOCATE LN,COL,1
- 3110 J$ = INKEY$:IF J$ = "" THEN GOTO 3110 ELSE J = ASC(RIGHT$(J$,1))
- 3120 IF J = 27 THEN ESC.FLAG% = 1: RETURN
- 3122 IF J = 13 THEN LOCATE ,,0:RETURN
- 3130 IF J = 8 THEN GOSUB 3190 : GOTO 3090
- 3135 IF INSTR("1234567890SsPpBbVvYyNn+-./><=",J$)=0 THEN BEEP:GOTO 3090
- 3140 IF PRT = 1 THEN LOCATE LN,COL,0 : PRINT J$;: P$ = P$ + J$ : COL = COL + 1
- 3150 Z = Z + 1 : GOTO 3090
- 3180 RETURN
- 3190 N = COL : N = N - 1 : J$ = "" 'BACKSPACE
- 3200 IF N <= 0 THEN BEEP: COL = 0 : RETURN ELSE LOCATE LN,N,1: PRINT " ";
- 3210 IF P$ = "" THEN RETURN ELSE N$ = LEFT$(P$, LEN(P$) - 1 ):P$ = N$:Z=Z-1
- 3220 COL = N
- 3230 RETURN
- 3250 '
- 3251 ' GENERAL ERROR HANDLER
- 3252 '
- 3260 LOCATE 23,1,0:PRINT SPACE$(60):LOCATE 23,10,0
- 3270 IF ERR = 53 THEN PRINT "FILE NOT FOUND. PLEASE COPY THE DATA FILES TO THIS DISK AND RE-START":GOSUB 3040:GOTO 2710
- 3280 IF ERR = 71 THEN PRINT "DISK IS NOT READY. CHECK DISK DRIVE DOOR.";:GOTO 3300
- 3290 IF ERR = 27 THEN PRINT "YOUR PRINTER IS NOT READY.";:GOTO 3300
- 3295 PRINT "GENERAL ERROR: ERROR # - ";ERR;", LINE - ";ERL;" PLEASE CALL PC DISK.":GOSUB 3040:GOSUB 3040:GOTO 2710
- 3300 LOCATE 24,10:PRINT "PLEASE CORRECT AND PRESS ANY KEY TO CONTINUE."
- 3310 P$=INKEY$:IF P$="" THEN 3310 ELSE RESUME
- 3320 '
- 3321 ' TITLE SCREEN
- 3322 '
- 3330 GOSUB 42000
- 3390 C = 65
- 3400 SP$ = STRING$(13,32)
- 3410 X$ = "STOCK / BOND DATA FILE
- 3420 TITLE$ = X$+SP$
- 3430 FOR Y = 1 TO 10
- 3440 FOR Z = 1 TO 10
- 3450 FOR E = 1 TO 19 :NEXT E
- 3460 FOR A = 1 TO 5
- 3470 FOR X = 1 TO LEN(TITLE$)
- 3480 L = L + 1
- 3490 T$ = MID$(TITLE$,L,1)
- 3500 H$ = H$ + T$
- 3510 LOCATE 8,C:PRINT H$
- 3520 C = C-1: IF C < 30 THEN 3570
- 3530 SOUND 1700,0.25
- 3540 NEXT X
- 3550 NEXT A:NEXT Z: NEXT Y
- 3570 LOCATE 11,35:PRINT ">>>>>><<<<<<": LOCATE 14,29:PRINT "Copyright (1984). PC-DISK."
- 3580 GOSUB 3040:RETURN
- 40000 '
- 40001 ' BOX-DRAW ROUTINES
- 40002 '
- 41000 LOCATE LN,COL,0: PRINT ULC$
- 41010 FOR X = COL +1 TO RC - 1
- 41020 LOCATE LN,X: PRINT HORI$;
- 41030 NEXT
- 41040 PRINT URC$
- 41050 FOR X = LN +1 TO BR -1
- 41060 LOCATE X,RC : PRINT VERT$
- 41070 NEXT
- 41080 LOCATE BR,RC : PRINT LRC$
- 41090 FOR X = RC - 1 TO COL +1 STEP -1
- 41100 LOCATE BR,X : PRINT HORI$
- 41110 NEXT X
- 41120 LOCATE BR,COL: PRINT LLC$
- 41130 FOR X = BR - 1 TO LN + 1 STEP -1
- 41140 LOCATE X,COL : PRINT VERT$
- 41150 NEXT X
- 41160 COLOR 7,0: RETURN
- 41170 '
- 42000 CLS: COLOR 0,7: X$ = CHR$(179) :Y$ = CHR$(205)
- 42010 LOCATE 5,15,0: PRINT CHR$(213): FOR X = 16 TO 66:LOCATE 5,X:PRINT Y$;:NEXT X:PRINT CHR$(184)
- 42020 FOR X = 6 TO 18 : LOCATE X,67 :PRINT X$:NEXT X
- 42030 LOCATE 19,67:PRINT CHR$(190):FOR X = 66 TO 16 STEP -1 :LOCATE 19,X :PRINT Y$:NEXT X:LOCATE 19,15:PRINT CHR$(212)
- 42040 FOR X = 18 TO 6 STEP -1: LOCATE X,15:PRINT CHR$(179): NEXT X:COLOR 7,0
- 42050 BOX.DONE%=1:RETURN
- 50000 '
- 50010 ' DATE ROUTINES
- 50020 '
- 51050 '<DT_INT_CONT>
- 51110 GOSUB 51180:IF NO.SLASH% THEN DT.FLAG%=-1:RETURN
- 51120 GOSUB 51360:GOSUB 51490
- 51140 IF MON.ORIG%<>MON.OUT OR DAY.ORIG%<>DAY.OUT OR YR.ORIG%<>YR.OUT THEN DT.FLAG%=-1 ELSE DT.FLAG%=0
- 51150 DT.INT%=DT:SCRATCH!=FRE("")
- 51160 RETURN
- 51170 '
- 51180 '<DT_PARSE>
- 51240 BRK.1%=0:BRK.2%=0:NO.SLASH%=0
- 51250 FOR N%=1 TO LEN(DAT$)
- 51260 ELEM$=MID$(DAT$,N%,1)
- 51270 IF ASC(ELEM$)>=48 AND ASC(ELEM$)<=57 THEN 51290
- 51280 IF BRK.1%=0 THEN BRK.1%=N% ELSE BRK.2%=N%
- 51290 NEXT
- 51295 IF BRK.1%=0 OR BRK.2%=0 THEN NO.SLASH%=-1:RETURN
- 51300 MON.ORIG%=VAL(LEFT$(DAT$,BRK.1%-1))
- 51310 DAY.ORIG%=VAL(MID$(DAT$,BRK.1%+1,BRK.2%-BRK.1%-1))
- 51320 YR.ORIG%=VAL(MID$(DAT$,BRK.2%+1,4))
- 51330 IF YR.ORIG%>1999 THEN YR.ORIG%=YR.ORIG%-1900
- 51340 RETURN
- 51350 '
- 51360 ' <DT_INT_COMP>
- 51420 DAY.INP=DAY.ORIG%:MON.INP=MON.ORIG%:YR.INP=YR.ORIG%
- 51430 YR.INP=YR.INP+1900
- 51440 IF MON.INP<3 THEN YR.INP=YR.INP-1:MON.INP=MON.INP+13:ELSE:MON.INP=MON.INP+1
- 51450 DT=INT(365.25*YR.INP)+INT(30.6001*MON.INP)+DAY.INP-722527
- 51460 YR.INP=YR.INP-1900
- 51470 RETURN
- 51480 '
- 51490 ' <INT_DT>
- 51550 DT1=DT+722527:YR.OUT=INT((DT1-122.1)/365.25)
- 51560 MON.OUT=INT((DT1-INT(365.25*YR.OUT))/30.6001)
- 51570 DAY.OUT=DT1-INT(365.25*YR.OUT)-INT(30.6001*MON.OUT)
- 51580 IF MON.OUT>13 THEN MON.OUT=MON.OUT-13 ELSE MON.OUT=MON.OUT-1
- 51590 YR.OUT=YR.OUT-1900:IF MON.OUT<3 THEN YR.OUT=YR.OUT+1
- 51600 IF YR.OUT>99 THEN YR.PRN$=FNSTRIP$(YR.OUT+1900) ELSE YR.PRN$=FNSTRIP$(YR.OUT)
- 51610 DT.PRN$=FNSTRIP$(MON.OUT)+"/"+FNSTRIP$(DAY.OUT)+"/"+YR.PRN$
- 51620 RETURN
- 52000 ' <DBD>
- 52002 DAT$=DAT1$:GOSUB 51050:DT.1%=DT.INT%
- 52004 IF YR.ORIG% MOD 4=0 AND MON.ORIG%<3 THEN Y.1.LEN%=366 ELSE Y.1.LEN%=365
- 52006 DAT$=DAT2$:GOSUB 51050:DT.2%=DT.INT%
- 52008 IF YR.ORIG% MOD 4=0 AND MON.ORIG%<3 THEN Y.2.LEN%=366 ELSE Y.2.LEN%=365
- 52010 DBD%=DT.2%-DT.1%:RETURN
- 52019 '
-