Basic games - not C128 but easily convertible - Biorythms

Started by Blacklord, August 13, 2007, 09:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Blacklord

0 REM   Prog.Name  BIOVN     after Practical Computing July 1979
    1 POKE318,195:POKE320,224:REM   Initialise INP = GET
   20 CLEAR 1024:DIM M$(12),D$(31)
   21 DIM D(12),P(23),E(28),I(33),L(57),H(36)
   30 FOR C=1 TO 12:READ M$(C),D(C):NEXT
   31 FOR C=1 TO 4:READ D$(C):NEXT:FOR C=5 TO 20:D$(C)=D$(4):NEXT
   32 FOR C=21TO30:D$(C)=D$(C-20):NEXT:D$(31)=D$(21)
   33 FOR C=1 TO 23:READ P(C):NEXT
   34 FOR C=1 TO 28:READ E(C):NEXT
   35 FOR C=1 TO 33:READ I(C):NEXT
   40 PRINTCHR$(12):PRINT:PRINT:PRINT:D(2)=28:GOSUB 4000:GOSUB 5000
   50 REM  D(2)=28 is in case last chart was for Feb of a leap-year
   60 REM  4000 gets birthdate and name
   70 REM  5000 gets month and year for chart, then calls 2000
   80 REM  2000 starts printer and prints headings on chart
   89 REM
   90 REM  **** START OF CHART CALCULATIONS AND PRINTING ****
   91 REM
  100 C=FRE(D$):FOR J=1 TO D(M)
  110 FOR C=1 TO 57:L(C)=32:NEXT:L(29)=ASC(":")
  120 P1=P1+1:IF P1=24 THEN P1=1
  130 E1=E1+1:IF E1=29 THEN E1=1
  140 I1=I1+1:IF I1=34 THEN I1=1
  150 L(P(P1))=80:L(E(E1))=69:L(I(I1))=73:REM  Letters P,E,I
  160 IF P(P1)=E(E1) THEN L(P(P1))=163:   REM  """ sign...
  170 IF E(E1)=I(I1) THEN L(E(E1))=163:   REM  ...for the...
  180 IF I(I1)=P(P1) THEN L(I(I1))=163:   REM  ...coincidences
  190 IF P(P1)=29 THEN PRINT ">";:OUT 0,7
  200 IF E(E1)=29 THEN PRINT ">";:OUT 0,7
  210 IF I(I1)=29 THEN PRINT ">";:OUT 0,7
  220 PRINTTAB(5-LOG(J+1)/LOG(10));J;
  230 FOR C=1 TO 57:PRINTCHR$(L(C));:NEXT
  240 FOR C=1 TO 35:H(C)=32:NEXT:H(C)=ASC(":")
  250 IF P(P1)=33 THEN H(1)=62:H(36)=80:REM   62=ASC(">")
  260 IF I(I1) <> 32 THEN 290
  270 H(36)=73:DUMMY=H(1):H(1)=62:IF DUMMY=62 THEN H(2)=62
  280 IF P(P1)=33 THEN H(36)=163
  290 IF H(1)<>32 THEN OUT 0,7
  300 FOR C=1 TO 36:PRINTCHR$(H(C));:NEXT:PRINT
  310 NEXT J
  320 PRINTSPC(7);:FOR C=8 TO 64:PRINT".";:NEXT
  330 PRINT:PRINT:PRINTTAB(15);"ANY MORE CHARTS TO BE DONE ?"
  340 KEY=INP(9):IF KEY=0 THEN 340
  350 IF KEY=89 THEN 40
  360 POKE318,219:POKE320,201:REM   Restore  original INP
  370 END
 2000 REM   Subroutine to print headings
 2001 PRINTCHR$(12):PRINT:PRINT:PRINT
 2002 PRINTTAB(6);
 2003 PRINT"Use the RUN\STOP key as a pause control as necessary"
 2004 PRINT:PRINT:PRINT
 2010 PRINT"BIORHYTHM CHART for ";N$;"  (Birthdate";STR$(B1);
 2020 PRINT D$(B1);" ";M$(B2);STR$(B3);")":PRINT
 2030 PRINT"Chart prepared for the month of ";M$(S2);S3:PRINT
 2040 PRINTTAB(16);"PASSIVE";SPC(9);"CRITICAL";SPC(9);"ACTIVE"
 2050 PRINTSPC(7);:FOR C=8 TO 64:PRINT"=";:NEXT:PRINT:PRINT
 2999 RETURN
 3000 DATA January,31,February,28,March,31,April,30
 3001 DATA May,31,June,30,July,31,August,31
 3002 DATA September,30,October,31,November,30,December,31
 3003 DATA st,nd,rd,th
 3010 DATA 29,36,44,50,54,56,57,55,52,47,40
 3011 DATA 33,25,18,11,6,3,1,2,4,8,14,21
 3012 DATA 29,36,41,47,50,54,56,57,56,54,50,47,41,36
 3013 DATA 29,22,17,11,7,4,2,1,2,4,7,11,17,22
 3014 DATA 29,35,39,44,49,51,54,56,57,57,55,53,50,47,42,36
 3015 DATA 32,26,21,16,11,7,5,3,1,1,2,4,7,9,14,19,23
 4000 REM   INPUT personal details for chart
 4010 INPUT"         Enter name for Chart ";N$
 4020 PRINT:PRINT"         Enter Date of Birth... ":PRINT
 4030 INPUT"                   Day number ";B1
 4040 INPUT"                 Month number ";B2
 4050 INPUT"                         Year ";B3
 4060 PRINT
 4070 IF B2>12 OR B2<1 THEN PRINT"RUBBISH !":PRINT:GOTO 4040
 4080 IF B1<=D(B2) AND B1>0 THEN 4100
 4081 IF B3/4=INT(B3/4) AND B2=2 AND B1=29 THEN 4100
 4090 PRINT"NONSENSE ! ";M$(B2);" has only";D(B2);"days":GOTO4030
 4100 IF B3<100 THEN B3=B3+1900
 4110 IF B3<2000 THEN 4130
 4120 PRINT"I don't beleive in issuing Biorhythm Charts for ";
 4121 PRINT"anyone born":PRINT"later than December 31st 1999."
 4122 GOTO 4010
 4130 PRINTCHR$(12):PRINT:PRINT
 4140 PRINT"BIORHYTHM CHART for ";N$;":    born";B1;CHR$(1);
 4150 PRINT D$(B1);" ";M$(B2);B3:PRINT:PRINT:PRINT:PRINT
 4160 PRINT"Enter date required for chart...":PRINT
 4170 INPUT"                 Month number ";S2
 4180 INPUT"                  Year number ";S3
 4190 IF S2>12 OR S2<1 THEN PRINT"RUBBISH !":PRINT:GOTO 4170
 4200 IF S3<100 THEN S3=S3+1900
 4220 IF S3>1900 THEN 4230
 4221 PRINT"I don't believe the calculations would ";
 4222 PRINT"be accurate for any"
 4223 PRINT"period before January 1st 1900.  Sorry."
 4230 IF S3+S2/12>B3+B2/12 THEN 4999
 4231 PRINT"I don't consider the calculations would have any ";
 4232 PRINT"meaning":PRINT"for any period before ";N$;"'s birth."
 4233 GOTO 4160
 4999 S1=1:A=0:RETURN
 5000 REM   Set up parameters for chart
 5010 IF B3+1>S3-1 THEN 5050
 5020 FOR Y=B3+1 TO S3-1
 5030 IF INT(Y/4)*4=Y AND INT(Y/100)*100<>Y THEN A=A+1
 5040 NEXT Y:REM   Counts number of leap-years between B3 and S3
 5050 D1=(S3-B3-1)*365+A
 5060 IF B2<12 THEN FOR C=B2+1 TO 12:D1=D1+D(C):NEXT
 5070 D1=D1+D(B2)-B1+1
 5080 REM   If B3 is leap-year and B2 is before March, add 1
 5081 IF INT(B3/4)*4=B3ANDINT(B3/100)*100<>B3ANDB2<3 THEN D1=D1+1
 5090 REM   If S3 is leap-year then February has 29 days
 5091 IF INT(Y/4)*4=Y AND INT(Y/100)*100<>Y THEN D(2)=29
 5100 IF S2>1 THEN FOR C=1 TO S2-1:D1=D1+D(C):NEXT
 5110 P1=D1-INT(D1/23)*23
 5120 E1=D1-INT(D1/28)*28
 5130 I1=D1-INT(D1/33)*33
 5999 M=S2:GOSUB 2000:RETURN:REM   Do headings on chart