8-Bit Software Online Conversion
:2.$.Wdiary - Listing
2REM Weekly diary B.RAW K6N 1997
10*TV255
20*FX18
30*FX21
40*KEY10"*EXEC !BOOT|M"
50*FX4,1
60*FX229,1
70*FX225,200
80*FX226,210
90*FX227,220
100MODE7
110DIM M$(12),dd%(12,2)
120RESTORE
130FOR N%=1TO12:READM$(N%),dd%(N%,2):N
EXT
140days$=" MonTueWedThuFriSatSun"
150fm$=" JanFebMarAprMayJunJulAugSepO
ctNovDec"
160epson%=0
170sysclk%=0
180year%=0:L%=1:P%=1
190ONERROR:GOTO220
200F%=OPENIN"Wdata":INPUT#F%,year%,L%,
P%,epson%,sysclk%:CLOSE#F%
210PROCgetSDs
220ONERROR:VDU7:RUN
230VDU23;10,&60;0;0;0
240PROCstart
250PROCinit
260:
270REPEAT
280REPEAT
290H%=0
300$W%="W"+MID$(fm$,P%*3,3)
310VDU30,157,129
320PRINT"<H>elp <I>ndex <P>rint <['> <
Esc> [ ] "
330PRINTTAB(0,1)CHR$(157)CHR$(133)"
"M$(P%)" "STR$(year%)
340PROCload
350REPEAT
360Q%=GET
370UNTILINSTR("HIPhip",CHR$(Q%))ORQ%=1
3ORQ%=27ORQ%>135
380IFQ%>127:T%=0
390IFQ%=72ORQ%=104:PROChelp1
400IFQ%=73ORQ%=105:PROCindex
410IFQ%=80ORQ%=112:PROCvprint
420IFQ%=27:RUN
430IFQ%=136:L%=L%-1
440IFQ%=137:L%=L%+1
450IFQ%=138:P%=P%-1:L%=1
460IFQ%=139:P%=P%+1:L%=1
470IFL%<1:P%=P%-1:L%=1
480IFL%>max%:L%=1:P%=P%+1
490IFP%<1:P%=12:L%=1
500IFP%>12:P%=1:L%=1
510UNTILQ%=13 AND H%=0
520VDU30:PRINT$&A00:PRINTTAB(2,4);
530E%=E%EOR1:VDU23,1,E%;0;0;0;
540REPEAT
550a%=GET:A%=a%
560IFA%<>27:PROCkeys
570UNTILA%=27
580PROCsave
590E%=E%EOR1:VDU23,1,E%;0;0;0;
600UNTILFALSE
610:
620DEFPROCvprint
630VDU30:PRINT$&A00:VDU30,9,9
640PROCprint
650ENDPROC
660:
670DEFPROCkeys
680IFA%=16:PROCprint:ENDPROC
690IFA%=3:TEMP%=L%:L%=1:CNT%=1:REPEAT:
PROCnewpage:CNT%=CNT%+1:UNTILCNT%=TEMP%+
1:L%=TEMP%:ENDPROC
700IFA%=13ANDVPOS=24:VDU7:ENDPROC
710IFA%=13:VDU10,13,8:PROCright:ENDPRO
C
720IFINSTR("QWASZXqwaszx",CHR$(a%))<>0
ANDt%:PROCpixel:ENDPROC
730IFA%=136:PROCleft:ENDPROC
740IFA%=137:PROCright:ENDPROC
750IFA%=138:PROCdown:ENDPROC
760IFA%=139:PROCup:ENDPROC
770IFa%>=200ANDa%<=229:PROCfkeys
780IFA%=127:PROCdelete:ENDPROC
790IFA%=226:PROCinspc:ENDPROC
800REM IFA%=227:PROCinsline:ENDPROC
810REM IFA%=228:PROCdelline:ENDPROC
820IFA%=209ORA%=219ORA%=229:PROCptog:E
NDPROC
830IFE%=0:VDU7:ENDPROC
840IFVPOS=24ANDPOS=39ANDt%=0:?(&7C27+4
0*24)=A%:VDU7:ENDPROC
850IFt%=0ANDA%>31:VDUA%,8:PROCright
860ENDPROC
870:
880DEFPROCfkeys
890IFa%>=200ANDa%<=208:A%=a%-71
900IFa%>=210ANDa%<=216:A%=a%-65
910IFa%>=217ANDa%<=218:A%=a%-61
920IFa%>=220ANDa%<=221:A%=a%-67
930IFa%>=222ANDa%<=223:A%=a%-64
940IFa%>=224ANDa%<=225:A%=365-a%
950ENDPROC
960:
970DEFPROCpixel
980LOCALW%
990W%=2^((INSTR("QWASZ X",CHR$(A%AND22
3)))-1)
1000K%=&7C00+40*VPOS+POS
1010IF(?K%AND160)<>160:?K%=?K%OR160
1020IF?(K%ANDW%)=W%:?K%=?K%AND(255-W%)E
LSE?K%=?K%EORW%
1030ENDPROC
1040:
1050DEFPROCptog
1060t%=t%EOR1
1070IFt%:VDU23;10,&70;0;0;0 ELSE VDU23;
10,&60;0;0;0
1080ENDPROC
1090:
1100DEFPROCleft
1110IFPOS>2:VDU8:ENDPROC
1120IFVPOS>2:VDU31,39,VPOS-1ELSEVDU7
1130ENDPROC
1140:
1150DEFPROCright
1160IFPOS<39:VDU9:ENDPROC
1170IFVPOS<24:VDU9,9,9ELSEVDU7
1180ENDPROC
1190:
1200DEFPROCdown
1210IFVPOS<24:VDU10ELSEVDU7
1220ENDPROC
1230:
1240DEFPROCup
1250IFVPOS>2:VDU11ELSEVDU7
1260ENDPROC
1270:
1280DEFPROCdelete
1290IFPOS=2ANDVPOS=2:VDU7:ENDPROC
1300org%=&7C00+40*VPOS
1310IFPOS=2:PROCleft ELSE FORI%=POS TO
39:?(org%+I%-1)=?(org%+I%):NEXT:VDU8
1320?(&7C27+VPOS*40)=32
1330ENDPROC
1340:
1350DEFPROCinspc
1360dest%=&7C27+40*VPOS
1370org%=&7C00+40*VPOS+POS
1380diff%=dest%-org%
1390FORI%=0TOdiff%
1400?(dest%-I%)=?(dest%-I%-1)
1410NEXT
1420?org%=32
1430ENDPROC
1440:
1450DEFPROCinsline
1460LOCALP%
1470org%=&70:dest%=&74:end%=&78:stop%=&
7C
1480!org%=&7C27+40*23
1490!dest%=&7C27+40*24
1500!end%=&7C02+40*VPOS
1510!stop%=&7C27+40*VPOS
1520FORI%=0TO2STEP2
1530P%=&980
1540[OPTI%
1550LDY#0
1560.loop
1570LDA(org%),Y:STA(dest%),Y
1580LDAorg%::BNEd1
1590DECorg%+1
1600.d1
1610DECorg%
1620LDAdest%:BNEd2
1630DECdest%+1
1640.d2
1650DECdest%
1660LDAorg%+1:CMPend%+1:BNEloop
1670LDAorg%:CMPend%:BCSloop
1680RTS
1690]NEXT
1700CALL&980
1710REPEAT
1720?!end%=32
1730!end%=!end%+1
1740UNTIL!end%=!stop%+1
1750ENDPROC
1760:
1770DEFPROCdelline
1780LOCALP%
1790org%=&70:dest%=&74:end%=&78:stop%=&
7C
1800!org%=&7C02+40*(VPOS+1)
1810!dest%=&7C02+40*VPOS
1820!end%=&7C27+40*24
1830!stop%=&7C02+40*24
1840FORI%=0TO2STEP2
1850P%=&980
1860[OPTI%
1870LDY#0
1880.loop
1890LDA(org%),Y:STA(dest%),Y
1900INCorg%::BNEd1:INCorg%+1
1910.d1
1920INCdest%:BNEd2:INCdest%+1
1930.d2
1940LDAend%+1:CMPorg%+1:BNEloop
1950LDAend%:CMPorg%:BCSloop
1960RTS
1970]NEXT
1980CALL&980
1990REPEAT
2000?!end%=32
2010!end%=!end%-1
2020UNTIL!end%=!stop%-1
2030ENDPROC
2040:
2050DEFPROCprint
2060O%=&7C00:o%=0:graphic%=0:sep%=0
2070VDU2
2080IFepson%:VDU1,27,1,48
2090FORl%=1TO25
2100FORc%=1TO40
2110d%=?(O%+o%)
2120IFd%<32:d%=32
2130IFepson%=0 AND (d%<32ORd%>126):d%=3
2
2140IFd%>127ANDepson%:PROCeprint
2150IFd%=91ANDepson%:d%=0:VDU1,27,1,75,
1,8,1,0,1,0,1,&10,1,&38,1,&54,1,&10,1,&1
0,1,&10,1,&10
2160IFd%=93ANDepson%:d%=0:VDU1,27,1,75,
1,8,1,0,1,0,1,&10,1,&10,1,&10,1,&10,1,&5
4,1,&38,1,&10
2170VDU1,d%
2180o%=o%+1
2190NEXT
2200IFepson%:VDU1,10:REM LINE FEED AS R
EQUIRED
2210VDU1,13:graphic%=0:sep%=0
2220NEXT
2230IFepson%:VDU1,27,1,50
2240VDU1,13,3
2250ENDPROC
2260:
2270DEFPROCeprint
2280IFd%=&80:d%=32:ENDPROC
2290IFd%>&80 AND d%<&88:graphic%=0:d%=3
2:ENDPROC
2300IFd%>&87 AND d%<&91:d%=32:ENDPROC
2310IFd%>&90 AND d%<&98:graphic%=1:d%=3
2:ENDPROC
2320IFd%=&99:sep%=0
2330IFd%=&9A:sep%=1
2340IFd%>&97 AND d%<&A0:d%=32:ENDPROC
2350IFd%>&BF AND d%<&E0:d%=32:ENDPROC
2360IFgraphic%=0:d%=32:ENDPROC
2370PROCpixprint:d%=0
2380ENDPROC
2390:
2400DEFPROCpixprint
2410REM******* FOR EPSON PRINTER ******
2420flag%=0
2430FORn%=0TO6
2440flag%=flag%+(d%AND2^n%)
2450NEXT
2460:
2470VDU1,27,1,ASC"^",1,0,1,6,1,0
2480pr%=0
2490IFflag%AND1:pr%=pr%+&E0-(sep%*&20)
2500IFflag%AND4:pr%=pr%+&1C-(sep%*&04)
2510IFflag%AND16:pr%=pr%+&8003-(sep%*&8
000)
2520IFsep%:VDU1,0,1,0
2530FORn%=sep%TO2
2540VDU1,pr%AND&FF
2550VDU1,(pr%AND&FF00)DIV&100
2560NEXT
2570pr%=0
2580IFflag%AND2:pr%=pr%+&E0-(sep%*&20)
2590IFflag%AND8:pr%=pr%+&1C-(sep%*&04)
2600IFflag%AND64:pr%=pr%+&8003-(sep%*&8
000)
2610IFsep%:VDU1,0,1,0
2620FORn%=sep%TO2
2630VDU1,pr%AND&FF
2640VDU1,(pr%AND&FF00)DIV&100
2650NEXT
2660ENDPROC
2670:
2680DEFPROCnewpage
2690VDU30
2700FORD%=1TO24
2710PRINTCHR$(157)CHR$(132)STRING$(38,"
");
2720NEXT
2730PRINTCHR$(157)CHR$(132)STRING$(37,"
");
2740?(&7C27+40*24)=32
2750PRINTTAB(0,1)CHR$(157)CHR$(133)"
"M$(P%)" "STR$(year%)
2760VDU30
2770rl%=L%-1
2780FORdw%=1TO7
2790VDU13,10,10,10
2800PRINTCHR$(157)CHR$(133)MID$(days$,d
w%*3,3)" ";
2810IFL%<10 OR L%>dd%(P%,2):PRINT" ";
2820IF(rl%+dw%)<dd%(P%,1)ANDL%=1 OR L%>
dd%(P%,2) THEN PRINT" "CHR$(132); ELSE P
RINTSTR$(L%)CHR$(132);:L%=L%+1
2830PRINTSTRING$(15," -");
2840NEXT
2850PRINTTAB(2,4);
2860ENDPROC
2870:
2880DEFPROCindex
2890oldL%=L%:oldP%=P%
2900P%=1:REPEAT:L%=1:REPEAT
2910PRINTTAB(0,1)CHR$(157)CHR$(133)"
"M$(P%)" "STR$(year%)
2920$W%="W"+MID$(fm$,P%*3,3)
2930T%=0:PROCload
2940Q%=INKEY(100)
2950IFQ%=27:P%=12:L%=31
2960IFQ%=135:oldL%=L%:oldP%=P%:P%=12:L%
=max%
2970IFQ%=136:IFL%>=2:L%=L%-2:Q%=0
2980IFQ%=136:IFL%=1ANDP%>1:P%=P%-1:L%=m
ax%-1
2990IFQ%=137:IFL%<max%:L%=L%+1
3000IFQ%=138:IFP%>1:P%=P%-1:L%=L%-1:IFL
%>max%-1:L%=max%-1
3010IFQ%=139:L%=max%
3020L%=L%+1:UNTILL%>max%:P%=P%+1:UNTILP
%>12
3030L%=oldL%:P%=oldP%
3040T%=0:Q%=0
3050ENDPROC
3060:
3070DEFPROCload
3080X%=W%MOD256
3090Y%=W%DIV256
3100A%=&C0
3110F%=(USR&FFCE)AND&FF
3120PROCdisc(4,&398)
3130PRINTTAB(2,2);
3140VDU23,1,E%;0;0;0;
3150CLOSE#F%
3160ENDPROC
3170:
3180DEFPROCsave
3190X%=W%MOD256
3200Y%=W%DIV256
3210A%=&C0
3220F%=(USR&FFCE)AND&FF
3230T%=0
3240IFE%:PROCdisc(2,&398)
3250CLOSE#F%
3260F%=OPENOUT"Wdata":PRINT#F%,year%,L%
,P%,epson%,sysclk%:CLOSE#F%
3270ENDPROC
3280:
3290DEFPROCdisc(A%,K%)
3300max%=EXT#F%DIV&398
3310IFS%<4:PTR#F%=(L%-1)*&398
3320B%?0=F%
3330B%!1=&7C50
3340B%!5=K%
3350X%=B%MOD256
3360Y%=B%DIV256
3370CALL&FFD1
3380ENDPROC
3390:
3400DEFPROCstart
3410REM "
3420REM " 0 1 2 3 4 5 6
3430E%=0:VDU23,1,0;0;0;0;
3440REPEAT
3450VDU30
3460PRINT"
";
3470PRINT"
3480PRINT" Instructions
3490PRINT"
3500PRINT" Install your
3510PRINT" preprepared disc
3520PRINT" before running
3530PRINT" the program or
6i 6!5j
3540PRINT" install a blank
e:05 ez
3550PRINT" formatted disc
j
3560PRINT" and select item
£!
3570PRINT" 5 to prepare a
3580PRINT" new disc.
3590PRINT" The format of
3600PRINT" the disc will be
3610PRINT" detected by the
3620PRINT" program.
3630PRINT"
3640PRINT"
3650PRINT" Open Diary
3660PRINT" Read Time$ NO
3670PRINT" Epson 9pin NO
3680PRINT" * Command
3690PRINT" Prepare Disc
3700PRINT"
";
3710IFyear%:PRINTTAB(32,5)STR$(year%)
3720IFsysclk%:PRINTTAB(16,20)"YES";
3730IFepson%:PRINTTAB(16,21)"YES";
3740O%=&7C00+40*19:S%=-1
3750REPEAT
3760S%=S%+1:IFS%=5:S%=0
3770?(O%+S%*40)=32
3780Q%=GET
3790?(O%+S%*40)=131
3800UNTILQ%=13
3810IFS%=0:ENDPROC
3820IFS%=1:sysclk%=sysclk%EOR1:PROCcmos
chk
3830IFS%=2:epson%=epson%EOR1
3840IFS%=3:PROCoscli
3850IFS%=4:PROCprepdisc
3860UNTILFALSE
3870ENDPROC
3880:
3890DEFPROCprepdisc
3900CLS
3910INPUT'''"Which Year ? "year%
3920PRINT'''"Making a Weekly Diary for
";STR$(year%)
3930PRINT'"Continue Y/N ? "
3940Q$=GET$
3950IFQ$<>"Y"ANDQ$<>"y":RUN
3960PROCgetSDs
3970L%=1:P%=1
3980F%=OPENOUT"Wdata":PRINT#F%,year%,L%
,P%,epson%,sysclk%:CLOSE#F%
3990B%=&900:W%=&9F0
4000FORP%=1TO12
4010file$="W"+MID$(fm$,P%*3,3)
4020F%=OPENOUTfile$
4030L%=1
4040REPEAT
4050PROCnewpage
4060PROCdisc(2,&398)
4070UNTIL L%>dd%(P%,2)
4080CLOSE#F%
4090NEXT
4100L%=1:P%=1:S%=0
4110ENDPROC
4120:
4130REM "
4140REM " 0 1 2 3 4 5 6
4150DEFPROChelp1
4160VDU30,23,1,0;0;0;0;
4170PRINT"
";
4180PRINT"
";
4190PRINT"
";
4200PRINT"
`0 ";
4210PRINT"
u: ";
4220PRINT"
5 ";
4230PRINT"
! ";
4240PRINT"
";
4250PRINT" View Mode Cursor O
FF ";
4260PRINT"
";
4270PRINT" H.....This help
";
4280PRINT" I.....Index see next pa
ge ";
4290PRINT" P.....Print Page
";
4300PRINT" <['>.....Enter edit mode
";
4310PRINT" <Esc>.....Close the Diary
";
4320PRINT"
";
4330PRINT" Edit Mode Cursor O
N ";
4340PRINT"
";
4350PRINT" Once here any changes you m
ake will ";
4360PRINT" be saved on leaving i.e. af
ter you ";
4370PRINT" hit <Esc>, no prompt is ask
ed for ";
4380PRINT" before saving, so should yo
u not wish ";
4390PRINT" to save the changes you hav
e made hit ";
4400PRINT" the <Break> key.
";
4410PRINT"
";
4420?(&7C27+40*24)=32
4430Q%=GET
4440IFQ%<>27:PROChelp2
4450H%=1:Q%=13
4460ENDPROC
4470:
4480REM "
4490REM " 0 1 2 3 4 5 6
4500DEFPROChelp2
4510PRINTTAB(0,7);
4520PRINT" INDEX
";
4530PRINT"
";
4540PRINT" Cycles through the whole Di
ary ";
4550PRINT" use the cursor keys to jump
:- ";
4560PRINT"
";
4570PRINT" Left...back a week
";
4580PRINT"
";
4590PRINT" Right...forward a week
";
4600PRINT"
";
4610PRINT" Down...back a month
";
4620PRINT"
";
4630PRINT" Up...forward a month
";
4640PRINT"
";
4650PRINT" <Copy> Exit to current dat
e ";
4660PRINT"
";
4670PRINT" <Escape> Exit returning to
the ";
4680PRINT" intitial date
";
4690PRINT"
";
4700Q%=GET
4710IFQ%<>27:PROChelp3
4720H%=1:Q%=13
4730ENDPROC
4740:
4750REM "
4760REM " 0 1 2 3 4 5 6
4770DEFPROChelp3
4780PRINTTAB(0,7);
4790PRINT" Function Keys 1
";
4800PRINT"
";
4810PRINT" Ctrl+C....Clear Screen
";
4820PRINT" Ctrl+P....Print page
";
4830PRINT"
";
4840PRINT" f0...Red text
";
4850PRINT" f1...Green text
";
4860PRINT" f2...Yellow text
";
4870PRINT" f3...Blue text
";
4880PRINT" f4...Magenta text
";
4890PRINT" f5...Cyan text
";
4900PRINT" f6...White text
";
4910PRINT" f7...Flashing
";
4920PRINT" f8...Steady
";
4930PRINT" f9...Pixel editor
";
4940PRINT"
";
4950PRINT" <Esc>...Save, Return to
View Mode ";
4960PRINT"
";
4970Q%=GET
4980IFQ%<>27:PROChelp4
4990H%=1:Q%=13
5000ENDPROC
5010:
5020REM "
5030REM " 0 1 2 3 4 5 6
5040DEFPROChelp4
5050PRINTTAB(0,7);
5060PRINT" Function Keys 2
";
5070PRINT"
";
5080PRINT" Ctrl+C....Clear Screen
";
5090PRINT" Ctrl+P....Print page
";
5100PRINT"
";
5110PRINT" Shift+f0...Red graphics
";
5120PRINT" Shift+f1...Green graphics
";
5130PRINT" Shift+f2...Yellow graphics
";
5140PRINT" Shift+f3...Blue graphics
";
5150PRINT" Shift+f4...Magenta graphic
s ";
5160PRINT" Shift+f5...Cyan graphics
";
5170PRINT" Shift+f6...White graphics
";
5180PRINT" Shift+f7...Black backgroun
d ";
5190PRINT" Shift+f8...Colour backgrou
nd ";
5200PRINT" Shift+f9...Pixel editor
";
5210PRINT"
";
5220PRINT" <Esc>...Save, Return to
View Mode ";
5230PRINT"
";
5240Q%=GET
5250IFQ%<>27:PROChelp5
5260H%=1:Q%=13
5270ENDPROC
5280:
5290REM "
5300REM " 0 1 2 3 4 5 6
5310DEFPROChelp5
5320PRINTTAB(0,7);
5330PRINT" Function Keys 3
";
5340PRINT"
";
5350PRINT" Ctrl+C....Clear Screen
";
5360PRINT" Ctrl+P....Print page
";
5370PRINT"
";
5380PRINT" Ctrl+f0...Contiguous grap
hics ";
5390PRINT" Ctrl+f1...Seperated graph
ics ";
5400PRINT" Ctrl+f2...Hold graphics
";
5410PRINT" Ctrl+f3...Release graphic
s ";
5420PRINT" Ctrl+f4...Double height
";
5430PRINT" Ctrl+f5...Single height
";
5440PRINT" Ctrl+f6...Insert space
";
5450PRINT" Ctrl+f7...Insert line di
ssabled ";
5460PRINT" Ctrl+f8...Delete line di
ssabled ";
5470PRINT" Ctrl+f9...Pixel editor
";
5480PRINT"
";
5490PRINT" <Esc>...Save, Return to
View Mode ";
5500PRINT"
";
5510Q%=GET
5520ENDPROC
5530:
5540DEFPROCoscli
5550CLS:PRINT"*";:INPUT""L$:OSCLIL$
5560PRINT'"Hit Any Key":Q%=GET:RUN
5570ENDPROC
5580:
5590DEFPROCinit
5600CLS:t%=0
5610B%=&900:W%=&9F0
5620T%=0:M%=0
5630$&A00=CHR$(157)+CHR$(132)+STRING$(3
8," ")
5640IFsysclk%:PROCcmoschk
5660ENDPROC
5670:
5680DEFPROCgetSDs
5690Y4=INT(year%/4)
5700SD=year%+Y4-7*INT((year%+Y4)/7)
5710IFSD<1:SD=7
5720SD=SD-1
5730IFSD<1:SD=7
5740IFyear%=4*Y4:SD=SD-1:dd%(2,2)=29
5750FORI=1TO12
5760dd%(I,1)=SD
5770FORN=1TOdd%(I,2)
5780SD=SD+1:IFSD>7:SD=1
5790NEXT
5800NEXT
5810ENDPROC
5820:
5830DEFPROCcmoschk
5840T$=TIME$:D$=MID$(T$,5,2):M$=MID$(T$
,8,3)
5850L%=1:P%=INSTR(fm$,M$)/3
5860IFP%:ENDPROC
5870CLS
5880PRINT"There is something wrong with
your"
5890PRINT"CMOS memory! Check it with TI
ME$ it may"
5900PRINT"need resetting or your battar
ies may"
5910PRINT"need replacing. If you cannot
fix it"
5920PRINT"then do not try to set the CM
OS option"
5930END
5940ENDPROC
5950:
5960DEFPROCfinish
5970A%=0:Y%=0:CALL&FFCE
5980*FX4,0
5990*FX229,0
6000VDU23;10,&70;0;0;0
6010END
6020ENDPROC
6030:
6040DATA" January",31
6050DATA" February",28
6060DATA" March",31
6070DATA" April",30
6080DATA" May",31
6090DATA" June",30
6100DATA" July",31
6110DATA" August",31
6120DATA"September",30
6130DATA" October",31
6140DATA" November",30
6150DATA" December",31