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