0 'Prepared by the Byte Fyter 1 'For GEnie's Laptops RoundTable 2 'NEC 8201A adaptation by Dave Thomas 3 'See CodeWorks Issue 14; Nov/Dec 1987 4 'For detailed instructions 5 ' * Ecal.Bas * Event calendar by Karl L Townsend * 6 ' * CodeWorks Magazine, 3838 S. Warner St. Tacoma, WA 98409 7 ' * (206) 475-2219 voice, (206) 475-2356 modem download 8 GOTO10 9 Z$=INPUT$(1):Z=VAL(Z$):Z$=CHR$(ASC(Z$)AND223):RETURN 10 CLEAR2000:SCREEN,0' only if you need to 11 DEFINTG-Z:DIMDA$(200),CO(200,2),DW$(7),DM$(12),DD$(12),DF$(12),FA(42,3):RC=0:' 12 DT$=DATE$:' 13 ' Read in data 14 FORI=1TO7:READDW$(I):NEXTI:FORI=1TO12:READDM$(I):NEXTI:FORI=1TO12:READDD$(I):NEXTI:FORI=1TO12:READDF$(I):NEXTI:' 012345678901234567890123456789 15 ' you can put your own info in the following lines. 16 B$="These things we do that others may live":C$="Pennsylvania Wing":D$="Civil Air Patrol":E$="Activity - 1988 - Calendar":F$="Published by Rescue Section Headquarters Squadron 3101":' 17 ' print the heading and menu on the screen 18 CLS:PRINT:PRINTSTRING$(12,45)" The CodeWorks "STRING$(13,45):PRINT" E V E N T C A L E N D A R":PRINT" keeps track of important events":PRINTSTRING$(40,45);:PRINT:PRINTTAB(20)"Press any key ->";:GOSUB9:CLS:PRINTTAB(5)"1 - Input events 19 PRINTTAB(5)"2 - Edit events":PRINTTAB(5)"3 - Print out an event file":PRINTTAB(5)"4 - Print out a calendar month":PRINTTAB(5)"5 - Save an event file to disk":PRINTTAB(5)"6 - Load an event file from disk":PRINTTAB(5)"7 - End session 20 PRINT"Your choice ";:GOSUB9:CLS:ONZGOTO21,27,37,39,50,53,71:GOTO18:' 21 ' Input routine 22 PRINT:INPUT"Enter date (MMDD), Event";X1,DA$:IFLEN(DA$)>16THENDA$=LEFT$(DA$,16) 23 RC=RC+1:DA$(RC)=DA$:FORI=RC-1TO0STEP-1:IFX1>CO(I,1)THENCO(I+1,1)=X1:CO(I+1,2)=RC:I=0:GOTO25 24 CO(I+1,1)=CO(I,1):CO(I+1,2)=CO(I,2) 25 NEXTI:PRINT"Another entry (y/n)";:GOSUB9:IFZ$="Y"THEN22ELSE18 26 ' 27 ' Edit/Delete 28 PRINT:INPUT"Enter date of record (MMDD)";RD:FORI=1TORC:RS=I:IFRD<>CO(I,1)THEN30 29 I=RC 30 NEXTI 31 PRINTDA$(CO(RS,2)):PRINT"Is this the correct record? (y/n)";:GOSUB9:PRINT:IFZ$="Y"THEN34 32 RS=RS+1:IFCO(RS,1)=RDTHEN31 33 PRINT"There is no record with that MMDD.":GOTO35 34 RN$="":INPUT"Enter the correction ";RN$:DA$(CO(RS,2))=RN$ 35 PRINT"Another record to edit? (y/n)";:GOSUB9:IFZ$="Y"THEN28ELSE18 36 ' 37 ' File print 38 FORI=1TORC:LPRINTCO(I,1),CO(I,2),DA$(CO(I,2)):NEXTI:PRINT"Press Enter to continue ";:GOSUB9:GOTO18:' 39 ' Print the calendar month routine * 40 INPUT"Enter the number of the month to be printed ";MD:PRINT"Have you loaded your event file for this month (Y/N)";:GOSUB9:IFZ$="Y"THEN41ELSE18 41 GOSUB55:GOSUB63:X=1-VAL(DF$(MD)):FORI=1TO6:LPRINTTAB(5)STRING$(127,45):LPRINTTAB(5);:FORJ=1TO7:X=X+1:IFX>0THENDN$=STR$(X)ELSEDN$=" "'three spaces 42 IFX>VAL(DD$(MD))THENDN$=" "' two spaces 43 LPRINT":";DN$;SPACE$(17-LEN(DN$));:IFX>0THENEZ(J)=XELSEEZ(J)=0 44 NEXTJ:LPRINT":":FORJ=1TO5:LPRINTTAB(5);:FORK=1TO7:IFJ>2THENZZ=FA(EZ(K),J-2) 45 ' 01234567890123456789012345678901234567890123456789012345 46 IFZZ=0 ORJ=1 ORJ=2THENLPRINT": ";ELSELPRINT":";DA$(ZZ);SPACE$(16-LEN(DA$(ZZ))); 47 ' 012345678901234567890123456789012345678901234567890 48 NEXTK:LPRINT":":NEXTJ:IFX=>VAL(DD$(MD))THENI=6 49 NEXTI:LPRINTTAB(5)STRING$(127,45):TB=INT(42-LEN(B$))/2:LPRINTTAB(TB)B$:LPRINT" ":LPRINT" ":LPRINTTAB(3)"Special Notes:":FORI=1TO10STEP2:LPRINTTAB(3)STRING$(77,45):LPRINT" ":NEXTI:LPRINTTAB((80-LEN(F$))/2)F$:FORI=1TO9:LPRINT" ":NEXTI:GOTO18:' 50 ' Save to disk 51 PRINT"Current file is "FS$:INPUT"Enter filename for save";S$:IFS$=""THENFS$=FS$ELSEFS$=S$ 52 OPENFS$FOROUTPUTAS1:PRINT#1,RC,DT$:FORI=0TORC:PRINT#1,CO(I,1),CO(I,2),",",DA$(I):NEXTI:CLOSE1:GOTO18:' 53 ' Load from disk 54 INPUT"What filename ";FS$:OPENFS$FORINPUTAS1:INPUT#1,RC,DT$:PRINTFS$" dated "DT$" with"RC"records":FORI=0TORC:INPUT#1,CO(I,1),CO(I,2),DA$(I):NEXTI:CLOSE1:PRINT"Press Enter to continue ";:GOSUB9:GOTO18:' 55 ' Format data entries 56 PD=0:FORI=1TO31:FORJ=1TO3:FA(I,J)=0:NEXTJ:NEXTI:FORI=1TO93:IFI>RCTHENRETURN 57 MO=INT(CO(I,1)/100):IFMO<>MDTHEN62 58 IFMO>MDTHENRETURN 59 IFDA$(CO(I,2))=""THEN62 60 ET=CO(I,1)-MO*100:IFET=PDTHENXD=XD-1ELSEXD=3 61 PD=ET:FA(ET,XD)=CO(I,2) 62 NEXTI:RETURN:' 63 ' Print header of calendar month 64 ' 65 LPRINTCHR$(27)"W1"'set expanded print mode on 66 LPRINTTAB((40-LEN(C$))/2)C$:LPRINTTAB((40-LEN(D$))/2)D$:LPRINTTAB((40-LEN(E$))/2)E$:LPRINTTAB(5)STRING$(30,45):LPRINTTAB((40-LEN(DM$(MD)))/2)DM$(MD):LPRINTCHR$(27)"W0";' set expanded print mode off 67 ' 68 LPRINTCHR$(15)' set condensed print mode on 69 LPRINTTAB(5)STRING$(127,45):LPRINTTAB(5);:FORI=1TO7:' 0123456789012345678901234567890123456789 70 LPRINT":";SPACE$(7);DW$(I);SPACE$(7);:NEXTI:LPRINT":":RETURN:' 71 ' end of session 72 ' set printer back to normal 73 LPRINTCHR$(18)' return to normal print mode 74 MENU:' 75 DATA SUN,MON,TUE,WED,THU,FRI,SAT,JANUARY,FEBRUARY,MARCH,APRIL,MAY,JUNE,JULY,AUGUST,SEPTEMBER,OCTOBER,NOVEMBER,DECEMBER,31,29,31,30,31,30,31,31,30,31,30,31,6,2,3,6,1,4,6,2,5,7,3,5 76 END' of program